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

Amos Jeffries squid3 at treenet.co.nz
Wed Mar 9 14:53:24 UTC 2016


On 10/03/2016 3:33 a.m., Antony Stone wrote:
> On Wednesday 09 March 2016 at 15:29:48, Tomas Mozes wrote:
> 
>> 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?
>>
>> What I can do is to add a cdn.example.com server alias to the origin, then
>> it works of course.
> 
> 1. Why not do that, then?
> 
> 2. Have you considered using Apache in reverse-proxy mode instead of Squid?  
> It will happily re-write headers for you, and also supports load balancing 
> around multiple servers, which would possibly give you a high-availability 
> solution as well.

What do you mean "and also" ? Apache 'proxy' behaviours are all copied
from Squid one way or another. It is an origin shoehorned into doing
proxy stuff.

Amos



More information about the squid-users mailing list