httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Knoblauch <kn...@knobisoft.de>
Subject [users@httpd] How to print request headers before and after processing
Date Thu, 22 Mar 2018 16:23:37 GMT
Hi,

 so I need some little help. I need to modify request headers in some
situations and for debugging, I want to print the content of the header
before and after processing. So I looked at mod_log_config and found:

----
%{VARNAME}i : The contents of VARNAME: header line(s) in the request sent
to the server. Changes made by other modules (e.g. mod_headers
<http://httpd.apache.org/docs/current/mod/mod_headers.html>) affect this.
If you're interested in what the request header was prior to when most
modules would have modified it, use mod_setenvif
<http://httpd.apache.org/docs/current/mod/mod_setenvif.html> to copy the
header into an internal environment variable and log that value with the %{
VARNAME}e described above.
----

 And actually %{varname}i prints out the processed request header. Where I
have problems is the "use mod_setenvif
<http://httpd.apache.org/docs/current/mod/mod_setenvif.html> to copy the
header into an internal environment variable" part. The request header in
question is "Cookie". So I tried to do the following:

a) in httpd.conf

    LogFormat "%t [%{ms}T ms] %h %u \"%m %U '%{login_jsid}e' '%{Cookie}i'\"
s:%>s l:%b S:%{SSL_PROTOCOL}x C:%{SSL_CIPHER}x" xxxlogheader

b) in the virtual host

    SetEnvIfExpr "%{REQUEST_URI} == '/cb2/facelets/logon.xhtml' &&
%{REQUEST_METHOD} == 'GET'" login_get login_jsid=%{HTTP_COOKIE}e
    CustomLog "..../apache2/logs/login_log" xxxlogheader env=login_get

So I would actually expect the content of the Cookie  being printed twice
when doing no additional processing. Instead I get:

   "GET /xxx/facelets/logon.xhtml '%{HTTP_COOKIE}e' 'JSESSIONID=yyyyy;
/xxx_textLocale=en/US'"

 Which indicates that my assignment in the SetEnvIfExpr directive is wrong.
Any help how to get that right?

TIA
Martin
-- 
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de
www: http://www.knobisoft.de

Mime
View raw message