0

I have a bit of a strange request in that I am trying to use a proxy.pac file to use a proxy server for the following:

www.domain.com
www.domain.xx.xx
www.domain.com/?foo=1&bar=1  (where foo/bar can be any querystring)

but not:

www.domain.com/folder/
subdom.domain.com

I have tried the following but it did not appear to work when testing:

function FindProxyForURL(url, host) {
    if (shExpMatch(url, "www.domain.*/?*")) return "PROXY 1.2.3.4:1234";
    return "DIRECT";
}
James
  • 656
  • 2
  • 10
  • 24
  • does the domain name you don't want to match contains the string `folder`? – Avinash Raj Jul 06 '14 at 12:24
  • No, folder was just an example unfortunately – James Jul 06 '14 at 17:42
  • then how we differentiate these two strings, `www.domain.com/?foo=1&bar=1`, `www.domain.com/folder/` – Avinash Raj Jul 06 '14 at 17:46
  • One is prefixed with a question mark after the domain name? – James Jul 06 '14 at 19:35
  • Forget that approach. If you find an interesting domain, split the URL in parts (e.g. protocol, address, port, path, query string) and decide with those pieces to which proxy you want to redirect, if at all. I'm not saying it's impossible with regexps, just that it won't be easy to understand later, and as a consequence, not easily maintainable. – acelent Jul 07 '14 at 11:25

0 Answers0