[squid-dev] How to rewrite URL in squid proxy server according to client's custom request header?
Amos Jeffries
squid3 at treenet.co.nz
Thu Aug 2 10:43:59 UTC 2018
On 01/08/18 08:27, Abu Noman wrote:
> How can I rewrite the destination in Squid proxy server according to the
> client's request header?
>
This is a usage question. Please followup in squid-users mailing list.
The answer is yes and no.
No - Squid does not do any re-writing. It calls a helper process or
script to determine if, when, and how re-writing is done.
see <http://www.squid-cache.org/Doc/config/url_rewrite_program/>
> *Details:*
> If I call an API likeĀ |GET www.google.com <http://www.google.com/>
> HTTP/1.0\r\nGo:www.google.com.bd <http://www.google.com.bd/>|
That request is invalid, even in HTTP/1.0. Any HTTP agent receiving the
request should reject, or at minimum reformat it to:
GET / HTTP/1.0
Host: www.google.com
Go: www.google.com.bd
As you should see, no need to bother with this "Go" header. Just send
the correct Host header. The client intention will be clear and do the
correct thing regardless of which HTTP agent(s) are processing the
message. The message does not even have to reach the mentioned "API" to
be delivered to the correct server. An intermediary closer to the client
may perform the delivery via a more efficient route.
This valid message being used is _important_ since most HTTP messages go
through between 2 and 8 layers of proxying in the modern Internet.
Whether you can see those layers or not they are there.
Amos
More information about the squid-dev
mailing list