Another important point is that squid must be configured as a transparent (intercepting) proxy for this to work properly and the Host header must be forwarded to squid (that's done by including the proxy_params file).
I've attached my full squid config, just in case someone would need an out-of-the-box solution.
I've attached my full squid config, just in case someone would need an out-of-the-box solution.