Way to chain proxy.pac files via URL

configurationPROXY

It is necessary for several of our laptops to operate on both our own and customer-based networks. This often involves switching proxy settings, which we did via a custom proxy.pac file at first (after some help from you here). Now, one of the networks we use has their own proxy.pac that we must use which means that currently, we have to manually change our proxy.pac location for that network.

So, is there a way to write a proxy.pac such that it defers to another proxy.pac in some circumstances?

Best Answer

No, not within a static .pac file. The problem would be that you would end up redefining the FindProxyForURL() function when the second file was loaded which would set off the javascript interpreter.

You would need to develop a dynamic page (ASP, PHP, etc) that would implement the required logic and then, based on the decision, read in the contents of the desired .pac file and serve it back to the client. I used to do this to build in some dynamic load balancing between proxies that I had in different physical locations and it worked well for me.

If you choose to go this route, make sure that the script you write sets the return mime type to application/x-ns-proxy-autoconfig or application/x-javascript-config, otherwise your browser will not recognize it as a pac file.