httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jsl...@gmail.com>
Subject Re: [users@httpd] Allowing real ip address
Date Thu, 27 Jan 2005 18:18:01 GMT
On Thu, 27 Jan 2005 18:40:15 +0100, Ivan Belmonte
<ivan.belmonte@es.servidores.com> wrote:
> I've just written a PHP script that shows me the whole header.
> 
> HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR variables have the real ip value.
> REMOTE_HOST and REMOTE_ADDRvariables have the proxy ip value.
> 
> Yes, I can see the real IP into the header fields, but I'm trying to do it appear on
logs, following this way:
> 
>   LogFormat "%{HTTP_CLIENT_IP}i %h %l %u %t \"%r\" %>s %b" common
> 
> But it shows no address. Changing the first "i" for an "a" shows the proxy IP (is okay
as it shows http://httpd.apache.org/docs/mod/mod_log_config.html).
> So I think that Apache is not really reading my variables.
> 
> How can I show that variables on my "common" logs, and how can I trap the value with
SetEnvIf?

The HTTP_ part is an indication that the variable comes from an HTTP
request header; it is not part of the header itself.  In addition,
"-"s are converted into "_" when naming env variables.  So the read
HTTP header looks like "Client-IP" and you can use just ${CLIENT-IP}i
for the logs.

The same goes for SetEnvIf, so you should be able to use
SetEnvIf Client-IP ^123\.456\.789\.123$ goodip
Order Deny,Allow
Deny from all
Allow from env=goodip

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message