I’m trying to setup HaProxy as a load balancer for squid proxies and it’s working fine with http, but I can’t make it work with https.
I’m trying to setup something like this:
Client : Uses "https://proxy.mydomain.com:8081" as navigation proxy
|
(https)
|
V
HaProxy : Frontend is configured to receive https request on port 8081
Backend configured forward to squid proxy sever via http on port 8080
|
(http)
|
V
Squid Proxy : Receives http requests on port 8080
My certificate (and chained certificate) is correct if I try openssl s_client -connect proxy.mydomain.com:8081 :
...
SSL handshake has read 3388 bytes and written 388 bytes
Verification: OK
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 2048 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
In the logs i’m getting errors: May 14 12:05:05 haproxysrv haproxy[2507533]: 10.49.199.197:64773 [14/May/2024:12:05:05.909] https_in/1: SSL handshake failure
I configured the same with http only and it’s working fine:
OK I found a solution for the SSL Handshake, it seems to be mainly a client configuration issue… But i’m not satified with the solution.
Indeed, I had to separate HTTP and HTTPS trafic:
HTTP Request → HTTP Proxy
HTTPs Request → HTTPs Proxy
I had to change my PROXY.PAC file to use HTTPS proxy redirection:
function FindProxyForURL(url, host)
{
// variable strings to return
var proxy_http = "PROXY proxy.mydomain.com:8080";
var proxy_https = "HTTPS proxy.mydomain.com:8081"
var proxy_no = "DIRECT";
// REGLES //
// Somes rules for urls that don't need PROXY
// Redirtect to HTTPS Proxy if proto is HTTPS
if (url.startsWith("https:") || url.startsWith("snews:")) {
return proxy_https;
}
//Redirect to HTTP Proxy if proto is HTTP
return proxy_http;
}
I had to do so because if I handle HTTP trafic from my PROXY.PAC via an HTTPS Proxy, the connexion fails due to headers not handled by Squid.
Any idea if I can force HTTP request to pass through HTTPS connexion between client and HA Proxy?
I want this scenario to be true for HTTP or HTTPS requests:
Client : Uses "https://proxy.mydomain.com:8081" as navigation proxy
|
(https)
|
V
HaProxy : Frontend is configured to receive https request on port 8081
Backend configured forward to squid proxy sever via http on port 8080
|
(http)
|
V
Squid Proxy : Receives http requests on port 8080