0

I have a server that sits behind a reverse proxy that require client IP address, and to achieve that I'm trying with the lines below to add X-Forwarded-For in the request header,

RequestHeader set "X-Forwarded-For" %{REMOTE_ADDR}e

However, the above lines doesn't send the client IP address, it's sending (null) to the server.

This is my VirtualHost configuration

<VirtualHost *:80>
    ServerName targetserver.com
    ServerAlias www.targetserver.com/
    ProxyPreserveHost On
    RewriteEngine On

    RequestHeader set "Host" "targetserver.com"

    RequestHeader set "X-Forwarded-For" %{REMOTE_ADDR}e
    #Header add "X-Forwarded-For" %{REMOTE_ADDR}e

    RewriteRule ^/(.*) http://targetserver.com/$1 [P,L]
    ProxyPassReverse / http://targetserver.com

</VirtualHost>

How to fix it? Or, is there any other way to get client IP address?

Zia
  • 3
  • 3

0 Answers0