0

I'm working on a chrome extension where a button click would trigger a function that calls a specific url and gets back the response. This specific url needs to be accessed through a proxy. All other requests are handled normally. It seemed like pac file would fit the bill nicely, but there is one problem with it. The url that I need to access through a proxy has a path in in, like so:

https://www.myurl.com/segment-1/segment-2/segment-3

The PAC example I lifted from Chrome documentation is this:

        mode: "pac_script",
        pacScript: {
          data: "function FindProxyForURL(url, host) {\n" +
                "  if (host == 'foobar.com')\n" +
                "    return 'PROXY blackhole:80';\n" +
                "  return 'DIRECT';\n" +
                "}"
        }
      };

So I was hoping that I can examine the url parameter on every request and when mine is detected, I would return a proxy. The problem, however, lies in the fact that url argument in FindProxyForURL contains only domain part of the url, https://www.myurl.com in my case. I know it because I actually put alerts inside my FindProxyForURL code and logged the url and host values.

Is this a bug? As I was searching for documentation on PAC files, I found examples where url passed in is a full url, not the stripped one, like mine (https://findproxyforurl.com/example-pac-file/).

Thank you!

Lukich
  • 686
  • 1
  • 10
  • 20
  • 2
    It is intentional. For security purposes the full URL is not sent to proxies. – wOxxOm Mar 31 '20 at 04:19
  • Do you happen to have any links to documentation on this? I'm not quite sure why this is a security issue since it's my own PAC file. Thank you! – Lukich Mar 31 '20 at 16:37
  • 1
    Actually I found it myself - https://chromium.googlesource.com/chromium/src/+/master/net/docs/proxy.md#Arguments-passed-to-FindProxyForURL_in-PAC-scripts – Lukich Mar 31 '20 at 16:43

0 Answers0