HTTPs proxy server only works in SwitchOmega

后端 未结 1 1311
醉梦人生
醉梦人生 2020-12-09 22:01

I did quite a lot search and pratical trials before asking this question.

Long story:

I found a (non-English)tutorial about how to write a http proxy with No

相关标签:
1条回答
  • 2020-12-09 22:52

    I found the answer in Security StackExchange. Is it possible to connect to a proxy with an ssl (or otherwise encrypted) connection?

    From https://wiki.squid-cache.org/Features/HTTPS#Encrypted_browser-Squid_connection :

    Encrypted browser-Squid connection

    While HTTPS design efforts were focused on end-to-end communication, it would also be nice to be able to encrypt the browser-to-proxy connection (without creating a CONNECT tunnel that blocks Squid from accessing and caching content). This would allow, for example, a secure use of remote proxies located across a possibly hostile network.

    Squid can accept regular proxy traffic using https_port in the same way Squid does it using an http_port directive. Unfortunately, popular modern browsers do not permit configuration of TLS/SSL encrypted proxy connections. There are open bug reports against most of those browsers now, waiting for support to appear. If you have any interest, please assist browser teams with getting that to happen.

    ...

    Chrome

    The Chrome browser is able to connect to proxies over SSL connections if configured to use one in a PAC file or command line switch. GUI configuration appears not to be possible (yet).

    Firefox

    The Firefox 33.0 browser is able to connect to proxies over TLS connections if configured to use one in a PAC file. GUI configuration appears not to be possible (yet), though there is a config hack for embedding PAC logic.

    More information related to Chrome can be found in http://dev.chromium.org/developers/design-documents/secure-web-proxy.


    To answer the questions:

    1. Can I connect to the https proxy server through the ordinary way(without an extension)? If possible, how?

    The traditional way(e.g. Manual proxy configuration field in Firefox) to set a http proxy server is for HTTP proxy server only. One can only set a https proxy via pac files (e.g. Automatic proxy configuration URL field in Firefox).

    1. Why can I connect to the https proxy server through SwitchOmega?

    The SwitchOmega extension in fact generates a pac file for Chrome to use, though how it interacts with Chrome is so far unknown to me.

    By clicking the Export PAC button in SwitchOmega, I get a file contains:

    var FindProxyForURL = function(init, profiles) {
        return function(url, host) {
            "use strict";
            var result = init, scheme = url.substr(0, url.indexOf(":"));
            do {
                result = profiles[result];
                if (typeof result === "function") result = result(url, host, scheme);
            } while (typeof result !== "string" || result.charCodeAt(0) === 43);
            return result;
        };
    }("+test", {
        "+test": function(url, host, scheme) {
            "use strict";
            if (/^127\.0\.0\.1$/.test(host) || /^::1$/.test(host) || /^localhost$/.test(host)) return "DIRECT";
            return "HTTPS myHttpsProxyServer.com:9999"; // This line matters
        }
    });
    

    From https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_(PAC)_file:

    HTTP host:port   
    The specified proxy should be used   
    HTTPS host:port 
    The specified HTTPS proxy should be used  
    
    1. I think I build a https proxy server. But why others are saying that "There's no such thing as a https proxy server?

    Yes I build a https proxy server/a http proxy server over tls connection. Those who says "There's no such thing as a https proxy server" are wrong.

    0 讨论(0)
提交回复
热议问题