I have been running Squid as a reverse proxy to an Apache origin server on the same host. Squid and Apache use the same port number but different addresses, as recommended (the public routable address for Squid, 127.0.0.1 for Apache).

I would like to change this configuration (at least in development, if not in production) so that both the reverse proxy and the origin server use the public routable address, but different port numbers. I understand that one of the pitfalls to consider is that proxied response headers and response bodies will contain the origin server port number. But since I control the origin server, I can make it base any port numbers appearing in a response on the port number in the request "Host:" header.

But I can't seem to get Squid to pass the original port number through. Even with "httpd_accel_uses_host_header on" the origin server sees its own port number in the requests.

Is the behavior I seek supported?

Here are some relevant settings:

http_port 0.0.0.0:8114
httpd_accel_host 0.0.0.0
httpd_accel_port 8101
httpd_accel_single_host on
httpd_accel_uses_host_header on

I'm using "0.0.0.0" to get "public routable address" and "localhost".

To be clear, I would like Squid to accept a request on port 8114 with a "Host:" header like this:

Host: x.y.z:8114

Then, on cache miss, send the request to port 8101 on the same machine with the same "Host:" header:

Host: x.y.z:8114

It does this except that it changes the "Host": header to this:

Host: x.y.z:8101

-Ben

Reply via email to