Re: [squid-users] request_header_access & request_header_replace

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sun, 21 Jul 2013 21:15:49 +1200

On 20/07/2013 11:21 a.m., Dave Burkholder wrote:
> Hi everyone,
>
> I'm running an ICAP client that can't read sdch content encodings so I
> want to strip those headers out. (I realize this is mostly an edge
> case anyway, but never mind that for now).
>
> I have these rules to strip out the Accept-Encoding header if it
> contains sdch.
>
> acl sdch req_header Accept-Encoding [-i] sdch
>
> request_header_access Accept-Encoding deny sdch
>
>
> What is the relationship between request_header_access and
> request_header_replace?

As documented in the config manual
http://www.squid-cache.org/Doc/config/request_header_access/

"

The option is applied to individual outgoing request header
        fields. For each request header field F, Squid uses the first
        qualifying sets of request_header_access rules:

            1. Rules with header_name equal to F's name.
            2. Rules with header_name 'Other', provided F's name is not
               on the hard-coded list of commonly used HTTP header names.
            3. Rules with header_name 'All'.

        Within that qualifying rule set, rule ACLs are checked as usual.
        If ACLs of an "allow" rule match, the header field is allowed to
        go through as is. If ACLs of a "deny" rule match, the header is
        removed and request_header_replace is then checked to identify
        if the removed header has a replacement. If no rules within the
        set have matching ACLs, the header field is left as is.

"

>
> If I want to strip sdch and allow gzip, would the following ruleset
> accomplish this?
>
> acl sdch req_header Accept-Encoding [-i] sdch
>
> request_header_access Accept-Encoding deny sdch
>
> request_header_replace Accept-Encoding Accept-Encoding: gzip

It will strip out any Accept-Encoding line containing sdch and replace
it with a line accepting *only* gzip content. Regardless of whether the
client accepts gzip as well as sdch.

>
> Does the request_header_replace only fire if request_header_access
> actually matched?

See above.

Amos
Received on Sun Jul 21 2013 - 09:15:57 MDT

This archive was generated by hypermail 2.2.0 : Sun Jul 21 2013 - 12:00:05 MDT