On Tue, Aug 9, 2011 at 15:20, Zaid Amireh <[email protected]> wrote: > > On Aug 8, 2011, at 3:56 PM, Ben Noordhuis wrote: > >> On Mon, Aug 8, 2011 at 10:29, Zaid Amireh <[email protected]> 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? > > Zaid
