[squid-users] Reverse Proxy translate public domain to internal path

Amos Jeffries squid3 at treenet.co.nz
Tue Jun 23 13:28:41 UTC 2015


On 24/06/2015 12:32 a.m., sqca wrote:
> Hi folks,
> 
> I have started to use Squid 3.5.5 to implement a reverse proxy for multiple
> webservers. Some of them are publishing multiple websites on the same port
> so I need to do the following:
> Publish "site1.example.com" via Squid which points at 192.168.0.1:8080/test
> Publish "site.example.com" via Squid which points at
> 192.168.0.1:8080/production
> and so on.
> 
> What do I need to do to accomplish this? Is it really necessary to use the
> url_rewrite_program directive?

For this. Yes. The rewrite (*not* redirect) is necessary to change the
path segment. The rest is normal for virtual hosting.

However, its really a bad idea to do it this way (with /path
differences) in the first place.

Ideally you have the server doing virtual hosting for the two domain
names and using port 80 as well. Squid then just passes the requests
traffic to the right server and the server itself does not then have to
care about getting port and path etc right in every URL reference the
cotent contains, just uses relative URLs. A site like that can even be
proxied for HTTPS quite easily.

Amos



More information about the squid-users mailing list