HTTPS connections over proxy servers

前端 未结 9 1014
你的背包
你的背包 2020-11-28 18:48

Is it possible to have HTTPS connections over proxy servers? If yes, what kind of proxy server allows this?

Duplicated with How to use Socks 5 proxy with Apache HTT

相关标签:
9条回答
  • 2020-11-28 19:36

    tunneling HTTPS through SSH (linux version):

    1) turn off using 443 on localhost
    2) start tunneling as root: ssh -N login@proxy_server -L 443:target_ip:443
    3) adding 127.0.0.1 target_domain.com to /etc/hosts
    

    everything you do on localhost. then:

    target_domain.com is accessible from localhost browser.
    
    0 讨论(0)
  • 2020-11-28 19:37

    as far as i can remember, you need to use a HTTP CONNECT query on the proxy. this will convert the request connection to a transparent TCP/IP tunnel.

    so you need to know if the proxy server you use support this protocol.

    0 讨论(0)
  • 2020-11-28 19:45

    The short answer is: It is possible, and can be done with either a special HTTP proxy or a SOCKS proxy.

    First and foremost, HTTPS uses SSL/TLS which by design ensures end-to-end security by establishing a secure communication channel over an insecure one. If the HTTP proxy is able to see the contents, then it's a man-in-the-middle eavesdropper and this defeats the goal of SSL/TLS. So there must be some tricks being played if we want to proxy through a plain HTTP proxy.

    The trick is, we turn an HTTP proxy into a TCP proxy with a special command named CONNECT. Not all HTTP proxies support this feature but many do now. The TCP proxy cannot see the HTTP content being transferred in clear text, but that doesn't affect its ability to forward packets back and forth. In this way, client and server can communicate with each other with help of the proxy. This is the secure way of proxying HTTPS data.

    There is also an insecure way of doing so, in which the HTTP proxy becomes a man-in-the-middle. It receives the client-initiated connection, and then initiate another connection to the real server. In a well implemented SSL/TLS, the client will be notified that the proxy is not the real server. So the client has to trust the proxy by ignoring the warning for things to work. After that, the proxy simply decrypts data from one connection, reencrypts and feeds it into the other.

    Finally, we can certainly proxy HTTPS through a SOCKS proxy, because the SOCKS proxy works at a lower level. You may think a SOCKS proxy as both a TCP and a UDP proxy.

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