I have a smart-dns setup, Using dnsmasq as the dns server, which always resolves to my server ip address, for a given list of domains.
I want to configure either a webserver or proxy program to listen on port 80 and 443 on my server . Which then forwards all the web requests, to an external proxy server (squid) as proxy requests.
Would it be possible to do this, using programs like (nginx, harproxy, squid..etc), for both http and https traffic, without ssl termination on the server.
So far, none of the configs i have tested worked, Haproxy config.
frontend https_front
bind *:443
mode tcp
default_backend squid_backend_https
backend squid_backend_https
mode tcp
server squid_proxy 111.22.32.11:3323
Nginx config,
stream {
upstream ssl_backend {
server 111.22.32.11:3323;
}
server {
listen 443;
proxy_protocol on;
tcp_nodelay on;
proxy_pass ssl_backend;
ssl_preread on;
proxy_ssl_protocols TLSV1 TLSv1.2 TLSv1.3;
proxy_ssl_ciphers 'HIGH:!aNULL:!MD5';
proxy_ssl on;
proxy_ssl_server_name on;
#proxy_next_upstream on;
proxy_ssl_verify off;
}
}
I presume, that the backend program listening on 80 and 443, Should effectively, forward the http/https web request, as a proxy request to the external proxy server (squid).
Firstly, is this theoretically possible to achieve this, using just haproxy, squid, nginx, or any similar program.
Any help, on how to achieve this would be greatly appreciated. Thanks
Update 1
The external proxy server is needed to access the required websites. If i add the proxy ip:port manually on the browser, it works fine.
But i have some limitation on some applications, where the proxy cant be added. To bypass that issue, am testing out a setup where, the requests for those specific domains, the dns resolves, to my reverse proxy, which then needs to serve the requests through the external proxy server.
The dns part is working fine. It resolves to my reverse proxy ip, for the requried domains. Am stuck trying to configure the reverse proxy (not just nginx, open to any other program), to serve the requests through the external proxy .
The reverse proxy, does not have access to ssl certs for the domains. The ssl termination, is done after the request is forwarded to the external proxy server .
Update 2
Do not have the option to provision certificates for those domains, on the reverse proxy.
One way i could think of is configuring the reverse proxy to redirect the https traffic, along with SNI, to the external proxy, without terminating the ssl on the server.
The only machine, i can make any meaningful changes is on the reverse proxy server. The server is running Ubuntu 22.04.
The only change that can be made on the client machines is the dns server IP (dnsmasq server )
Do not have provision to make any changes to the external proxy (squid) .
The external proxy accepts only http-relay, Connect proxy connections.
Hope this makes the question bit more clear.