SERVER_ADDR env var is broken

#1
At least in RewriteCond directives in a .htaccess context, but probably elsewhere as well, this value contains the Listener Address setting. However, under Apache, it contains the actual IP address to which the connection was made, which seems like a clear incompatibility. All the code I've seen with SERVER_ADDR expects it to be an IP address.

Tested with this in .htaccess:
Apache config:
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_ADDR} .+
RewriteRule ^dump\.php$ - [END,E=lsws_server_addr:%0]
Then in dump.php:
PHP:
<?php
header('Content-Type: text/plain');
var_dump($_SERVER['SERVER_ADDR'], $_SERVER['lsws_server_addr']);
Under Apache (on a private IP) I get this:
Code:
string(9) "127.3.3.3"
string(9) "127.3.3.3"
Under LSWS it's like this:
Code:
string(14) "123.123.123.123"
string(5) "*:443"
 
Last edited:
Top