Proxy configuration to proxy only certain domains

Hi, I need to use a proxy and this is what I have so far:

  val httpProtocol: HttpProtocolBuilder = {
    val baseProtocol = http
      .baseUrl(system_env)
      .acceptLanguageHeader("en-GB,en;q=0.5")
      .doNotTrackHeader("1")
      .userAgentHeader(userAgent)
      .inferHtmlResources()

    if (proxyEnabled) {
      baseProtocol.proxy(Proxy("server", port)
        .httpsPort(port)
        .credentials(proxyUsername, proxyPassword))
        .noProxyFor("www.some_site.com")
    } else {
      baseProtocol
    }
  }

As you can see there is this option noProxyFor. I am wondering if there is something I can use to define it the other way around. Like, use proxy only for these domains?

No, it’s not supported. This exclusion strategy is also used in web browsers and Java (nonProxyHosts).

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.