2

I'm a web developer and I use squid as a proxy, which I entered in firefox as the proxy server. So when I enter http://www.example.com in firefox, I see the site on my local machine, by having configured squid accordingly.

Now problem is, that some of our customers have GBs of images, and it's a pain to load them all on my machine. So basically I want to use my offline webpage, but loading the images from the live server, so I don't have a broken site without images.

In order to do this I've tried to create a proxy.pac and configured it this way:

function FindProxyForURL(url, host) {

    if (shExpMatch(url, "*.jpg")) {
        return "DIRECT";
    } else {
        return "PROXY 192.168.178.31:3128; DIRECT";
    }

}

Unfortunately it doesn't really work. What am I doing wrong, and how can I achieve my goal?

C. S.
  • 127
  • 1
  • 2
  • 8

1 Answers1

1

According to the Mozilla document on PAC files:

The path and query components of https:// URLs are stripped. In Chrome, you can disable this by setting PacHttpsUrlStrippingEnabled to false, in Firefox the preference is network.proxy.autoconfig_url.include_path.

What this means is when you enter a url such as https://www.example.com/image.jpg, what gets passed to the PAC script is the url https://www.example.com. As a result, you're never going to enter the first condition of your if statement.

In Firefox, you can change this by going to the about:config page and setting network.proxy.autoconfig_url.include_path to true.

Allan
  • 123
  • 8