Search squid archive

Re: http host rewrite for origin (reverse proxy)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Wed, Mar 9, 2016 at 3:43 PM, Amos Jeffries <squid3@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxx
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!

_______________________________________________
squid-users mailing list
squid-users@xxxxxxxxxxxxxxxxxxxxx
http://lists.squid-cache.org/listinfo/squid-users

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux