9

I have the following problem with squid:

Some clients access concurrently 62 servers via a squid proxy. All servers have the same host name (www.example.com) but different public IPs (123.123.123.2 to 123.123.123.63). The server owner uses a kind of dns round robin.

I only have access to the squid server and to the clients. The connection to the servers is only allowed via the proxy IPs.

Without proxy, I just send a request to load data from http//123.123.123.5/dataforme but I send the host header "www.example.com". That works like it should.

But now using squid as a non caching proxy this is not possible anymore. Squid overrides the sent request host header. By doing this, the destination server does not know what data to deliver because the host-header is not correctly transmitted.

I set

url_rewrite_host_header off

But this does not have any effect. It seems that this option is only used when using squid as redirector. That is not what I do.

The following will work, if there were no other sites to fetch:

header_access Host deny all
header_replace Host www.example.com

But when I do this, every request will get the www.example.com host header. Then it is not possible to access other sites anymore.

What can I do?

Thanks in advance for your help!

3
  • What is the host header being rewritten to?
    – Andrew B
    Jan 9, 2013 at 21:27
  • The host header is rewritten to the IP address (123.123.123.5 in my example).
    – Chris
    Jan 10, 2013 at 0:33
  • Did you check if it is actually squid rewrites header but not "a kind of DNS round robin"? tcpdump could help...
    – kay27
    Jan 11, 2017 at 20:25

2 Answers 2

1

Standard Squid installations don't do so, unless with some faulty directives. If you are using a standard version, please redo the config from scratch. If it's a custom compilation, you should review the code and compile options.

2
  • 1
    Please specify wath compiler options should be enabled Apr 6, 2018 at 8:09
  • Mostly header rewrite options. Btw, I highly suggest you use default recommended options or a standard binary. Things may get messy & unstable with squid if you are not sure what you are compiling.
    – MTG
    Apr 7, 2018 at 9:29
0

Add these lines into your squid config. Lets see if it helps.

request_header_access Referer deny all
request_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Cache-Control deny all
forwarded_for off

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .