mod_remoteip and mod_rewrite interactions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Hi,
I use the module mod_remoteip (2.3.5) on Apache httpd 2.2 (Centos 5).
My Apache httpd is behind a load-balancer.
I have a strange behavior with mod_rewrite and mod_remoteip .
Here is a simple configuration for the virtual host that shows the strange behaviour :
<VirtualHost *:9090>
DocumentRoot "/var/www/html/"
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 10.76.98.0/24
RewriteLog var/logs/rw.log
RewriteLogLevel 9
Options +FollowSymLinks +ExecCGI
DirectoryIndex index.html
<Directory "/var/www/html">
RewriteEngine on
RewriteRule ^(.*)$ index2.html [QSA,L]
</Directory>
</VirtualHost>
The configuration is quite simple : whatever you requested, Apache always serves the URI index2.html.
So when I run the following request "wget http://<public IP>:9090/". I expect to see in the access log file my IP address, but instead this is the IP address of the load-balancer :
1.1.1.1 -"GET / HTTP/1.1" 304 -
If I take a look at the RewriteLog file I can see the following :
2.2.2.2 [rid#2aaee84d3ab8/initial] (3) [perdir /var/www/html/] strip per-dir prefix: /var/www/html/ ->
2.2.2.2 [rid#2aaee84d3ab8/initial] (3) [perdir /var/www/html/] applying pattern '^(.*)$' to uri ''
2.2.2.2 [rid#2aaee84d3ab8/initial] (2) [perdir /var/www/html/] rewrite '' -> 'index2.html'
2.2.2.2 [rid#2aaee84d3ab8/initial] (3) [perdir /var/www/html/] add per-dir prefix: index2.html -> /var/www/html/index2.html
2.2.2.2 [rid#2aaee84d3ab8/initial] (2) [perdir /var/www/html/] strip document_root prefix: /var/www/html/index2.html -> /index2.html
2.2.2.2 [rid#2aaee84d3ab8/initial] (1) [perdir /var/www/html/] internal redirect with /index2.html [INTERNAL REDIRECT]
1.1.1.1 [rid#2aaee84d85c0/initial/redir#1] (3) [perdir /var/www/html/] strip per-dir prefix: /var/www/html/index2.html -> index2.html
1.1.1.1 [rid#2aaee84d85c0/initial/redir#1] (3) [perdir /var/www/html/] applying pattern '^(.*)$' to uri 'index2.html'
1.1.1.1 [rid#2aaee84d85c0/initial/redir#1] (2) [perdir /var/www/html/] rewrite 'index2.html' -> 'index2.html'
1.1.1.1 [rid#2aaee84d85c0/initial/redir#1] (3) [perdir /var/www/html/] add per-dir prefix: index2.html -> /var/www/html/index2.html
1.1.1.1 [rid#2aaee84d85c0/initial/redir#1] (1) [perdir /var/www/html/] initial URL equal rewritten URL: /var/www/html/index2.html [IGNORING REWRITE]
My IP is known until the "[INTERNAL REDIRECT]" . So, my questions are :
- Is this internal redirect mandatory ?
- Is it normal that my IP address is lost after this redirect ?
I checked and the HTTP header X-Forwarded-For is correctly set.
Regards,
Laurent Vaills
[Index of Archives]
[Open SSH Users]
[Linux ACPI]
[Linux Kernel]
[Linux Laptop]
[Kernel Newbies]
[Security]
[Netfilter]
[Bugtraq]
[Squid]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Samba]
[Video 4 Linux]
[Device Mapper]