Re: [squid-users] [SOLVED] Strange issue with a 301 redirect and reverse proxying...

From: Chris Robertson <crobertson@dont-contact.us>
Date: Wed, 17 Jan 2007 11:19:49 -0900

David Fix wrote:
> Hey guys,
>
> I'm a new squid user, and have set up squid as a reverse proxy. I've
> searched on google, in the wiki, and in the mailing lists for an answer to
> this problem, but haven't found anything... It took me a bit to figure out
> what was going on. At first I thought it was squid doing it, but then after
> some heavy-duty research, I found out that it was apache
>
> I'm running squid and apache on a single server, running squid on port 80,
> and apache on port 81.
>
> The problem I *was* experiencing is this: When the URL
> http://mydomain.com/admin is requested, the apache server sends back a 301
> redirect to http://mydomain.com/admin/ (it adds a trailing slash).
>
> However, when this happens, apache ended up changing the redirect so that it
> looks like this:
> http://mydomain.com:81/admin/
>
> So, in case anyone is having this problem, I solved this by doing the
> following:
>
> In httpd.conf, I have the following:
> ---
> Port 80
> Listen 81
> UseCanonicalName On
> ---
>
> That makes apache LISTEN on port 81, but "pretends" it's on port 80 for when
> it rewrites the URLs. UseCanonicalName On makes it aware that it has to use
> the Port setting to rewrite the URL with.
>
> Then, in the virtualhost section, it looks like this:
> ---
> NameVirtualHost *:81
>
> <VirtualHost *:81>
> Port 80
> .
> .
> .
> </VirtualHost>
> ---
>
> That will allow the VirtualHost to work the same way.
>
> And that's all there is to it!
>
> I hope this helps someone!
>
> :)
>
> Dave
>
>
First of all, bravo for the creative solution.

Secondly, another solution is available in the FAQ
(http://wiki.squid-cache.org/SquidFaq/ReverseProxy#head-c7da685b97cb3783adaf61e8a807063c8f34e4f2).

Chris
Received on Wed Jan 17 2007 - 13:20:00 MST

This archive was generated by hypermail pre-2.1.9 : Thu Feb 01 2007 - 12:00:01 MST