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 11:33 AM, Amos Jeffries <squid3@xxxxxxxxxxxxx> wrote:
On 9/03/2016 4:32 a.m., Tomas Mozes wrote:
> Hello,
> I would like to create a file distribution cache with squid. There is an
> origin server that has some fixed limited capacity and I'd like to place a
> few servers close to clients, in a mesh configuration (reverse proxy).
>
> http_port 80 accel
> cache_peer IP_ORIGIN parent 80 0 default no-query no-digest
> no-netdb-exchange
> cache_peer IP_SIBLING1 sibling 3128 3130
> cache_peer IP_SIBLING2 sibling 3128 3130
> ...
>

Okay so far.

> Now the question is - is it possible to specify a mapping between the
> hostname used on the cache vs the origin hostname? For example the origin
> is reachable via storage.example.com and I'd like the cache to be
> accesssible via cdn.example.com. So when a request comes to cdn.example.com,
> it goes to the cache and it requests files from storage.example.com - map
> cdn.example.com -> storage.example.com. I failed to find such an option for
> cache_peer.


I'm not sure I follow, but it seems the answer is that what you are
looking for is:  "cache_peer" itself *is* the mapping.

 # the mapping to send requests to storage.example.com
 cache_peer storage.example.com 80 0 originserver name=SS

 # to decide _which_ requests go to storage.example.com
 acl CDN dstdomain cdn.example.com
 cache_peer_access SS allow CDN


There are two hostnames and a domain name involved with
CDN/accel/reverse-proxy setups. The three things are not necessarily the
same:

 * hostname_1 - the proxy server hostname
 * hostname_2 - the origin server hostname
 * domain  - the public FQDN the client is requesting

The two hostname are private if you wish. The domain is public with DNS
records pointing at the proxy(s).

Amos

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


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?

What I can do is to add a cdn.example.com server alias to the origin, then it works of course.

Thanks,
Tomas

_______________________________________________
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