javascriptgoogle-chromebrowserchromiumpac

Can PAC file contain query string?


I have a PAC file on my server, and it looks like this:

function FindProxyForURL(url, host) {
    var a = "55.15.75.65:8180";
    var b = "DIRECT";        
    var nolst = Array(
    "*.css",
    "*.js",        
    "*/corpgrp/*"
    );
    for(var i = 0; i < nolst.length; ++i) {
      if(shExpMatch(url, nolst[i])) {
        return b;
      }
    }
    return a;
  }

I set the PAC url in Chrome like this:

http://myserver.com/pac/get?id=334&proxy=55.15.75.65:8180

This currently has no effect within chrome and I can't get it to work. I was wondering what I am doing wrong here. Is it because I added query string to the pac url and somehow chrome can't fetch that?


Solution

  • Turned out the problem wasn't because of the query string, seems that you must add the word "PROXY" in capital before the proxy server itself.

    So my updated code will look like this:

    var a = "PROXY 55.15.75.65:8180";