trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shu Kit Chan <chanshu...@gmail.com>
Subject Re: Adding headers to 304 Responses
Date Sat, 23 Nov 2013 03:24:27 GMT
I think the problem is not with the plugin. The debug log is telling us
that, i think.
We can add a static header to the 304 response with no problem.

The situation is that -

1) There is a custom header (X-From-Apache) in the original response from
origin server.
2) This response is cached in ATS
3) When client uses IMS in the request, ATS responds with a 304.
4) The custom header is nowhere to be found in the 304 respond
5) And thus the header_rewrite plugin cannot get its value.

I think ATS is doing the right thing for 304 as mentioned here -
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5
So how do we override this behavior and/or let the header_rewrite plugin to
know about the X-From-Apache header in the original response?

Thanks.

Kit


On Fri, Nov 22, 2013 at 6:36 PM, Mark Moseley <moseleymark@gmail.com> wrote:

> On Fri, Nov 22, 2013 at 6:14 PM, James Peach <jpeach@apache.org> wrote:
>
>> On Nov 22, 2013, at 4:59 PM, Mark Moseley <moseleymark@gmail.com> wrote:
>>
>> > On Fri, Nov 22, 2013 at 4:46 PM, Shu Kit Chan <chanshukit@gmail.com>
>> wrote:
>> > From the header_rewrite plugin perspective,
>> > the 304 is coming straight out of ATS and not from origin server.
>> That's fine.
>> > So all the plugin does is to look up "X-From-Apache" from this
>> particular HTTP response between ATS and the client. It can't find it. So
>> it cancelled the add-header operation for "X-ATS-1".
>> > But the add-header operation for "X-ATS-2" is still getting done
>> without problem.
>> >
>> >
>> >
>> > However the header that's not seen by the headers_rewrite module is
>> stored in the cached response. If I do a non-conditional, non-"Pragma:
>> no-cache" request, there's likewise no request to the origin server but the
>> header gets seen by the headers_module.
>> >
>> > So I'm trying to figure out how to amend the list of headers ATS should
>> send back, in the event of a cache-fulfilled 304 request.
>>
>> It might help to trace the "header_rewrite" diagnostic tag with
>> proxy.config.diags.debug.tags. Can you also post your header_rewrite config
>> file ... I've found that the syntax can be unintuitive ..
>
>
>
> The header_rewrite config:
>
>
> cond %{SEND_RESPONSE_HDR_HOOK}
> add-header X-ATS-1 %{HEADER:X-From-Apache}
>
> cond %{SEND_RESPONSE_HDR_HOOK}
> add-header X-ATS-2 Hi
>
>
>
> Trace output:
>
> This is after the initial "Pragma: no-cache" request:
>
> [Nov 22 21:32:51.548] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> number of arguments: 2
> [Nov 22 21:32:51.548] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Loading header_rewrite config from /etc/trafficserver/header_rewrite.config
> [Nov 22 21:32:51.548] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Reading line: 1: cond %{SEND_RESPONSE_HDR_HOOK}
> [Nov 22 21:32:51.548] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Parser
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Reading line: 2: add-header X-ATS-1 %{HEADER:X-From-Apache}
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Parser
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Statement
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Operator
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for OperatorHeaders
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Statement
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Value
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for OperatorAddHeader
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Adding operator: add-header(X-ATS-1)
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Parser
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Statement
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Condition
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for ConditionHeader, client 0
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Matcher
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Reading line: 3:
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Reading line: 4: cond %{SEND_RESPONSE_HDR_HOOK}
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Parser
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Adding rule to hook=5
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Reading line: 5: add-header X-ATS-2 Hi
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Parser
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Statement
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Operator
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for OperatorHeaders
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Statement
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Value
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for OperatorAddHeader
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Adding operator: add-header(X-ATS-2)
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Reading line: 6:
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Adding rule to hook=5
> [Nov 22 21:32:51.549] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> adding hook: 5
>
>
> Then this is the If-Modified-Since request for the same header (satisfied
> out of the cache, no origin request)
>
> [Nov 22 21:32:56.772] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Resources (InkAPI)
> [Nov 22 21:32:56.772] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Building resource structure for hook (5)
> [Nov 22 21:32:56.772] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Adding TXN client request header buffers
> [Nov 22 21:32:56.772] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Adding TXN client response header buffers
> [Nov 22 21:32:56.772] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Getting Header: X-From-Apache, field_loc: 0x4fc6fa0
> [Nov 22 21:32:56.772] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Appending HEADER(X-From-Apache) to evaluation value -> Hi from apache
> [Nov 22 21:32:56.772] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> OperatorAddHeader::exec() invoked on header X-ATS-1: Hi from apache
> [Nov 22 21:32:56.772] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> adding header X-ATS-1
> [Nov 22 21:32:56.772] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> OperatorAddHeader::exec() invoked on header X-ATS-2: Hi
> [Nov 22 21:32:56.772] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> adding header X-ATS-2
> [Nov 22 21:33:04.412] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite_dbg)
> Calling CTOR for Resources (InkAPI)
> [Nov 22 21:33:04.412] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Building resource structure for hook (5)
> [Nov 22 21:33:04.412] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Adding TXN client request header buffers
> [Nov 22 21:33:04.412] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Adding TXN client response header buffers
> [Nov 22 21:33:04.412] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> Getting Header: X-From-Apache, field_loc: (nil)
> [Nov 22 21:33:04.412] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite) Would
> set header X-ATS-1 to an empty value, skipping
> [Nov 22 21:33:04.412] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> OperatorAddHeader::exec() invoked on header X-ATS-2: Hi
> [Nov 22 21:33:04.412] Server {0x2ebb4ce3ddc0} DIAG: (header_rewrite)
> adding header X-ATS-2
>

Mime
View raw message