Playing around with HTTP headers
As all the requests and responses pass through Squid, it can add, modify, or delete the HTTP headers accompanied with requests and responses. These actions are usually performed to achieve anonymity or to hide the client-specific information. Squid has three directives, namely,
request_header_access
,
reply_header_access
, and
header_replace
to modify the HTTP headers in requests and responses. Let's have a brief look at them.
Note
Please be warned that using any of these directives violates HTTP standards and may cause problems.
Controlling HTTP headers in requests
The directive
request_header_access
is used in combination with ACLs to determine whether a particular HTTP header will be retained in a request or if it will be dropped before forwarding the request. The advantage of having ACLs here is that they provide a lot of flexibility. We can selectively drop some HTTP headers for a few clients.
Let's have a look at the syntax of request_header_access
:
request_header_access...