17
votes

The JVM allows proxy properties http.proxyHost and http.proxyPort for specifying a HTTP proxy server and https.proxyHost and https.proxyPort for specifying a HTTPS proxy server .

I was wondering whether there are any advantages of using a HTTPS proxy server compared to a HTTP proxy server ?

Is accessing a https url via a HTTPS proxy less cumbersome than accesing it from a HTTP proxy ?

4

4 Answers

50
votes

HTTP proxy gets a plain-text request and [in most but not all cases] sends a different HTTP request to the remote server, then returns information to the client.

HTTPS proxy is a relayer, which receives special HTTP request (CONNECT verb) and builds an opaque tunnel to the destination server (which is not necessarily even an HTTPS server). Then the client sends SSL/TLS request to the server and they continue with SSL handshake and then with HTTPS (if requested).

As you see, these are two completely different proxy types with different behavior and different design goals. HTTPS proxy can't cache anything as it doesn't see the request sent to the server. With HTTPS proxy you have a channel to the server and the client receives and validates server's certificate (and optionally vice versa). HTTP proxy, on the other hand, sees and has control over the request it received from the client.

While HTTPS request can be sent via HTTP proxy, this is almost never done because in this scenario the proxy will validate server's certificate, but the client will be able to receive and validate only proxy's certificate, and as name in the proxy's certificate will not match the address the socket connected to, in most cases an alert will be given and SSL handshake won't succeed (I am not going into details of how to try to address this).

Finally, as HTTP proxy can look into the request, this invalidates the idea of security provided by HTTPS channel, so using HTTP proxy for HTTPS requests is normally done only for debugging purposes (again we omit cases of paranoid company security policies which require monitoring of all HtTPS traffic of company employees).

Addition: also read my answer on the similar topic here.

14
votes

There are no pros or cons. And there are no "HTTPS proxy" server.

You can tell the protocol handlers which proxy server to use for different protocols. This can be done for http, https, ftp and socks. Not more and not less.

I can't tell you if you should use a different proxy for https connections or not. It depends. I can only explain the difference of an http and https request to a proxy.

Since the HTTP Proxy (or web proxy) understands HTTP (hence the name), the client can just send the request to the proxy server instead of the actual destenation. This does not work for HTTPS. This is because the proxy can't make the TLS handshake, which happens at first. Therefore the client must send a CONNECT request to the proxy. The proxy establishes a TCP connection and just sends the packages forth and back without touching them. So the TLS handshake happens between the client and destenation. The HTTP proxy server does not see everything and does not validate destenation servers certificate whatsoever.

There can be some confusion with this whole http, https, proxy thing. It is possible to connect to a HTTP proxy with https. In this case, the communication between the client and the proxy is encrypted.

There are also so called TLS terminating or interception proxy servers like Squid's SSL Peek and Splice or burp, which see everything. But this should not work out of the box, because the proxy uses own certificates which are not signed by trusted CAs.

References

7
votes

If you mean connecting to a HTTP proxy server over TLS by saying HTTPS proxy, then

I was wondering whether there are any advantages of using a HTTPS proxy server compared to a HTTP proxy server ?

The advantage is that your client's connection to proxy server is encrypted. E.g. A firewall can't not see which host you use CONNECT method connect to.

Is accessing a https url via a HTTPS proxy less cumbersome than accesing it from a HTTP proxy ?

Everything is the same except that with HTTPS proxy, brower to proxy server connection is encrypted.

But you need to deploy a certificate on your proxy server, like how a https website does, and use a pac file to configure the brower to enable Connecting to a proxy over SSL.

For more details and a practical example, check my question and answer here HTTPs proxy server only works in SwitchOmega

0
votes

Unfortunately, "HTTPS proxy" has two distinct meanings:

  1. A proxy that can forward HTTPS traffic to the destination. This proxy itself is using an HTTP protocol to set up the forwarding.

In case the browser is trying to connect to a website using HTTPS, the browser will send a CONNECT request to the proxy, and the proxy will set up a TCP connection with the website and mirror all TCP traffic sent on the connection from the browser to the proxy onto the connection between the proxy and the website, and similarly mirror the response TCP packets from the webite to the connection with the browser. Hypothetically, the same mechanism using CONNECT could be used with HTTP traffic, but practically speaking browsers don't do that. For HTTP traffic, they send the actual HTTP request to the proxy, including the full path in the HTTP command (as well as setting the Host header: https://stackoverflow.com/a/38259076/10026

So, by this definition, HTTPS Proxy is a proxy that understands the CONNECT directive and can support HTTPS traffic going between the browser and the website.

  1. A proxy that uses HTTPS protocol to secure traffic forwarding.

In this mode (sometimes referred to as "Secure Proxy"), the connection between the browser and the proxy itself (used for either HTTP or HTTPS traffic) is protected by TLS. The browser uses the Proxy's own certificate to establish the secure connection with the proxy, and then sends either HTTP or HTTPS traffic, including CONNECT requests, on that connection as per (1). So, the traffic between the browser and the proxy is always encrypted with a TLS key derived using the Proxy's certificate, regardless of whether the traffic itself is encrypted with a key negotiated between the browser and the website. If HTTPS traffic is proxied via a secure proxy, it is double-encrypted between the browser and the proxy.

For example, the Proxy Switcher Chrome plugin has two separate settings to control each of these definitions:

enter image description here

It gets a bit more complicated because some proxies that proxy HTTPS traffic don't simply set up a TCP relay, as described in (1), but act as Intercepting Proxies. Using a spoofed website certificate, they effectively perform a Man-in-the-Middle attack (well, it's not necessarily an attack because it's expected behavior). Whereas the browser thinks it's using the website's certificate to set up a TLS tunnel with a website, it's actually using a spoofed certificate to set up TLS tunnel with the proxy, and the proxy sets up the TLS tunnel with the website. Then proxy has visibility into the HTTPS requests/responses. But all of that is completely orthogonal to whether the proxy is acting as a secure proxy as per (2).