[squid-users] How to add extra header in response in squid

Alex Rousskov rousskov at measurement-factory.com
Tue Aug 20 13:56:44 UTC 2024


On 2024-08-20 06:27, nikhil deshpande wrote:

> We have two open ports in squid.
> 
> Port 1 is transparent proxy with configuration like below
> http_port 127.0.0.1:12121

I assume you are using one of the interception modes (i.e. either 
"intercept" or "tproxy") in the above port configuration.


> Port 2 is cache proxy which cache all GET calls  with configuration like 
> below
> 
> http_port 127.0.0.1:12122 ssl-bump ...


> I want to add a response header in my response which we give from squid. 
> We are using below directive for the same
> 
> reply_header_add header_name header_value
> 
> It seems the below configuration is working fine with port # 2 (cache 
> port) however it does not work for port #1 (tunnel proxy). Can someone 
> tell how can I add custom response header for my all open ports?


Squid should apply reply_header_add to all[1] final HTTP responses and 
HTTP 1xx control messages (that Squid sees/sends), regardless of the 
port the corresponding HTTP requests were received on.

[1] The only known exception is CONNECT responses. Quality pull requests 
adding reply_header_add support for Squid-generated CONNECT responses 
are welcome. An _interception_ http_port usually does not get CONNECT 
requests, so I assume you are not dealing with this exception in your tests.

If your Squid responds to an HTTP GET request without honoring 
reply_header_add, it is a Squid bug. If you are using Squid v6 or later, 
_and_ can demonstrate that Squid actually handles the GET transaction in 
question, then please report that bug to Squid Bugzilla.


HTH,

Alex.



More information about the squid-users mailing list