[squid-users] http host rewrite for origin (reverse proxy)
Amos Jeffries
squid3 at treenet.co.nz
Wed Mar 9 10:33:56 UTC 2016
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
More information about the squid-users
mailing list