You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Georg v. Zezschwitz" <gv...@2scale.de> on 2008/11/21 18:00:54 UTC

ResponseHeaders to Environment

Hi,

I am uncertain if I should write my own "private" module or extends an  
existing Apache module.

I used to have in the past the situation that I wanted to log request  
headers, but did not want to pass them
to the backend by mod_proxy.

This is possible by first exporting the request header value to the  
environment, then dropping the
request header and logging the environment variable.

Now I need the other way round: The backend server (Tomcat) shall set  
several headers in
the response for logging purposes in the Apache log, but these headers  
should not be sent to the
(poor mobile) client. Using mod_headers intercepts too early: If  
"Header unset" is used, the
response header will not be accessible in a LogFormat "%{my-output- 
header}o" form.

So, I am looking for a method to transfer response header values to  
the environment and
log them with a "%{my-output-header}e" directive.

One approach would be to modify "mod_setenvif' by a "SetEnvIfLate"  
that also refers
to response headers.

Another approach would be to extend mod_env by a
	PassEnvRequestHeader <header1> <header2> <header..n>
	PassEnvResponseHeader <header1> <header2> <header..n>

I consider both approaches not being really beautiful... Any better  
idea?

Anyway, is my extension too exotic?

For a better understanding:
The backend application is a mobile rendering proxy. I want to log:
   - the actual URL that was fetched by the request
   - if the customer got an error message: The error message
   - the customer identity

Best regards,


Georg

Re: ResponseHeaders to Environment

Posted by "Akins, Brian" <Br...@turner.com>.
Seems like your own module would be small and straight forward.

There is a patch floating around for mod_setenvif that adds a filter for it
to act on response headers.  That may could be used, depending on the order
things happen.  I'd still like this patch to be committed, I can resubmit,
if you want to take a look.

Of course, this would be easy to do in lua... ;)
-- 
Brian Akins
Chief Operations Engineer
Turner Digital Media Technologies