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

Antony Stone Antony.Stone at squid.open.source.it
Wed Mar 9 14:33:50 UTC 2016


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.


Antony.

-- 
Douglas was one of those writers who honourably failed to get anywhere with 
'weekending'.  It put a premium on people who could write things that lasted 
thirty seconds, and Douglas was incapable of writing a single sentence that 
lasted less than thirty seconds.

 - Geoffrey Perkins, about Douglas Adams

                                                   Please reply to the list;
                                                         please *don't* CC me.


More information about the squid-users mailing list