[squid-users] Overwrite an URL containing an IP when it is requested with a custom Host header

jl joaolopes at gmx.com
Thu Oct 17 10:33:39 UTC 2019

Thanks both for your replies.

>>> Or for this: 
>>> curl -v -k -x IP:PORT -H "Host: 
>>> erlang.org" 
>>> to return "HTTP/1.1 200 OK" instead of "HTTP/1.1 404 Not Found" >

>That one is not a good idea. The origin server is producing that 404, 
>nothing to do with Squid. 

But in this case the Host header resolves to the IP in the URL and if we
simply do `curl -v -k -x IP:PORT http://erlang.org/doc/search/` it returns a
"HTTP/1.1 200 OK". Shouldn't be possible for Squid to use the Host header
instead of the IP in such cases and not rewriting the Host header with the
IP? Or such behavior would go against the RFC 7230 (HTTP/1.1):

   When a proxy receives a request with an absolute-form of
   request-target, the proxy MUST ignore the received Host header field
   (if any) and instead replace it with the host information of the
   request-target.  A proxy that forwards such a request MUST generate a
   new Host field-value based on the received request-target rather than
   forward the received Host field-value



Sent from: http://squid-web-proxy-cache.1019090.n4.nabble.com/Squid-Users-f1019091.html

More information about the squid-users mailing list