Setting a request header to value from POST data

Andres Ofner <[email protected]>
Newsgroups gmane.comp.apache.mod-security.user
Message-ID <[email protected]>
Dear list,

 

I am struggling for quite some time already but fail to see a working
solution.

Maybe you can give me an idea whether this can be done at all.

 

We need to retrieve some value from some POST data argument and pass it on
as (ideally) a new Header.

I thought this should be possible by matching the value via ARGS, write it
into an environment variable and user mod_headers/RequestHeader to add it to
the request before passing on to the backend via ProxyPass.

In code, I came up with this:

 

      SecRule ARGS:MERCHANTID "(\d+)"
"phase:2,id:81104,setenv:PMID=%{TX.0},pass"

      RequestHeader set POSTMERCHANTID "%{PMID}e" env=PMID

 

As ARGS includes the post values, PMID would be set to the complete matched
regex, and RequestHeader should set the new ReqHdr POSTMERCHANTID if PMID is
defined.

 

However, this does not work.

My assumption now is that both are executed in the fixup phase of Apache
handlers, and RequestHeader somehow is processed BEFORE mod_security.

Is this correct? Is there any chance to achieve the goal above in any other
way, maybe?

 

Also, I wonder why I failed to increase logging for 200 responses which by
default are excluded, when adding these to the SecRule:

log,auditlog,ctl:auditEngine=On,ctl:auditLogParts=+E,ctl:debugLogLevel=9

 

Something I overlooked?

 

 

Thanks,

Andres

_______________________________________________
mod-security-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mod-security-users
Commercial ModSecurity Rules and Support from Trustwave's SpiderLabs:
http://www.modsecurity.org/projects/commercial/rules/
http://www.modsecurity.org/projects/commercial/support/
smime.p7s (application/pkcs7-signature, 5.7 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.