[squid-users] http host rewrite for origin (reverse proxy)

Tomas Mozes hydrapolic at gmail.com
Wed Mar 9 15:30:40 UTC 2016


On Wed, Mar 9, 2016 at 3:43 PM, Amos Jeffries <squid3 at treenet.co.nz> wrote:

> On 10/03/2016 3:29 a.m., Tomas Mozes wrote:
> >
> > Hello Amos,
> > the origin server has multiple virtual hosts configured, so if it does
> not
> > receive the Host: header by which it is configured (like
> storage.example.com),
> > it will emit a 404.
> >
> > Currently, this does the following. The clients requests:
> > GET /test.txt HTTP/1.1
> > Host: cdn.example.com
> >
> > This comes to squid, it will then send the same request to the origin:
> > GET http://cdn.example.com/test.txt HTTP/1.1
> > Host: cdn.example.com
> >
> > The result is a 404. I would need squid to alter the Host: to
> > storage.example.com. Is that possible?
>
> It is (cache_peer forcedomain=X option). But if you do so you have to
> ensure that nothing, anywhere, ever references that 'private' domain in
> anything produced by the virtual host. That means everything from HTTP
> headers, down to embeded object links in PDFs / images / etc , and links
> generated by scripts from string bits.
>  It is rather a PITA to be sure you got everything if the site was not
> designed to be that way from the very beginning.
>
> >
> > What I can do is to add a cdn.example.com server alias to the origin,
> then
> > it works of course.
>
> Or you could use storage.example.com as the public domain name, with DNS
> records pointing at the proxy IPs and let them handle the traffic
> delivery like they are designed to.
>  If this is a vhost on the server, then it already has a different
> private name you can put in the cache_peer to get to it.
>
> Amos
>
> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-users
>


Thanks Amos, forceddomain is what I was looking for, shame on me I haven't
found it.

This answers my question, thank you very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20160309/4724984b/attachment.html>


More information about the squid-users mailing list