Last Updated: September 09, 2019
·
500
· cossou

Local development and subdomains

Hi,

did you ever wanted to work with real domain names and subdomains on your local machine?

It's easy, just create a file named .proxy.pac with:

function FindProxyForURL(url, host) {
    if (shExpMatch(host,"*.<YOUR_DOMAIN>")) {
        return "PROXY localhost";
    }
    return "DIRECT";
}

Now go to your Firefox and open Preferences > Advanced > Network > Settings... > Automatic Proxy Configuration URL and put:

file:///PATH/TO/.proxy.pac

And that's it! It can work with other browsers (didn't test it myself).

Source & credits: Stackoverflow