Home > database >  How can I add RequestHeader from the x-forwared-for?
How can I add RequestHeader from the x-forwared-for?

Time:01-21

I added configuration like below to create custom RequestHeader on httpd.conf file(apache 2.4.51) enter image description here

CodePudding user response:

The construct your using does not return a string, it's just a match. When you use it in string context, it's not interpreted right.

Try this simpler recipe w/o expressions

SetEnvIf X-Forwarded-For "(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$" xff=$1
RequestHeader set x-client-ip %{xff}e env=xff

If you ultimately need something more sophisticated with expressions, use setenvif still to transform the input into an envvar then use envvars in your expression.

  •  Tags:  
  • Related