Switch firefox to use a different DNS than what is in the windows.host file

前端 未结 9 1185
误落风尘
误落风尘 2021-02-05 01:50

For example, I have a development site on a different server but I\'m trying to copy content over from the live site so it\'d be handy to have the live site in IE and the dev si

9条回答
  •  借酒劲吻你
    2021-02-05 02:31

    Since http proxy protocol is similar to raw http protocol, you can redirect desired traffic to your development server by telling firefox it's a proxy server.

    two limitations:

    A. this won't let you use https connections.

    B. some frameworks (e,g: wordpress) don't like this method and redirect the request the wrong way

    just copy the following code into a .pac file (enter your site domain and IP address, of course), and switch development/production just by changing proxy configuration.

    function FindProxyForURL(url, host) {
        var prox4site = {
            "mysite.com":"PROXY 10.0.1.100:80",
            "www.mysite.com":"PROXY 10.0.1.100:80"
        }
    
        return prox4site[host] || "DIRECT";
    }
    

提交回复
热议问题