httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: mod_proxy and modified headers in filters.
Date Tue, 09 Aug 2011 14:11:37 GMT
On 09.08.2011 15:37, Ben Noordhuis wrote:
> On Tue, Aug 9, 2011 at 15:20, Zaid Amireh <tumbak@gmail.com> wrote:
>>
>> On Aug 8, 2011, at 3:56 PM, Ben Noordhuis wrote:
>>
>>> On Mon, Aug 8, 2011 at 10:29, Zaid Amireh <tumbak@gmail.com> wrote:
>>>> I'm writing a module for Apache 2.2 that changes the content and thus needs
to set a new C-L header, all is working perfectly for static files and content generated from
content handlers (PHP & Ruby Passenger Phusion), an issue arose when testing with mod_proxy,
it seems that any changes the module does to the HTTP headers are being ignored by mod_proxy.
>>>>
>>>> mod_proxy keeps serving the headers it first got from the backend source
and disregards any changes my module does, is it possible to change the headers in this case?
>>>
>>> Yes. Have a look at proxy_hook_fixups() in mod_proxy.h.
>>
>> I just tried proxy_hook_fixups and it runs even before the proxy gets the content
from the backend which is not what I need, I also tried the other hook proxy_hook_request_status
and this one runs after the content has been sent to the client which means changing the headers
in it will have no effect.
>>
>> I found proxy_hook_post_request which fits nicely to where I need to change the headers
but it is only executed when the backend sends an error so that won't work as well.
> 
> post_request should always run, excluding error conditions like bad
> requests. Maybe that behaviour has changed over time but I don't think
> so, most of the code in mod_proxy is pretty old.
> 
>> Did I miss something here?

As far as I can see, mod_sed, mod_substitute and mod_proxy_html all need
to do something similar and all three do it in a filter, not in a hook.

mod_substitute is part of httpd 2.2 and trunk, mod_sed of trunk and
mod_proxy_html is available form Nick Kew's website. Have a look at
those as examples.

Regards,

Rainer

Mime
View raw message