My Squid Reverse Proxy only accepts HTTPS requests. What is a short way to redirect/rewrite a HTTP-request to https?
So if the user visits http://foo.server.com
he should be automatically redirected to https://foo.server.com
Squid reverse proxy redirect / rewrite HTTP to HTTPS
httpsreverse-proxysquid
Related Topic
- Squid url rewrites https>>http
- How to setup squid to do just reverse proxy
- Ssl – Apache ajp reverse proxy redirect a specific page to https
- NGINX Reverse Proxy – URL Rewrite
- Centos – Multiple SSL certificates with Squid reverse proxy
- Nginx: reverse proxy and http to https redirect
- Transparent HTTPs proxy with Squid 3.5
Best Answer
One way is to get the origin server to do the redirect, but it seems more efficient to get Squid to do it. There are a couple of approaches, but using deny_info seems the easiest.
In the squid.conf configuration file:
At first glance, the http_access statement just denies access to the HTTP version of your site. However due to the deny_info statement Squid will redirect users to an alternative site (in this case the HTTPS version) rather than simply giving an access-denied message.
The
%R
tag causes the request URL path to be included in the redirect, so that if users try to visithttp://foo.server.com/bar
then they'll get directed tohttps://foo.server.com/bar
, rather than justhttps://foo.server.com
.The full list of URL format tags is available in the Squid documentation: http://www.squid-cache.org/Doc/config/deny_info/
The order of the acl statements is important because Squid only remembers the last
http_access deny
and looks for thedeny_info
to match that acl.