Hello,
I have strange problem. If i enter phpinfo file i get:
_SERVER["REMOTE_ADDR"] 80.239.242.1
_SERVER["HTTP_X_FORWARDED_FOR"] 79.173.35.1
So my IP is 80.239.242.1
I want to block access to location from other ips then ip in url. For
example
location ~ ^/([0-9\.]+)/(.*?)$ {
if ($remote_addr != $1) {
return 404;
}
}
But it doesn't work correctly :(
1.) I will see value of variable $remote_addr, and it is correct result.
The
result is: 80.239.242.1
location ~ ^/([0-9\.]+)/(.*?)$ {
echo $remote_addr;
}
2.) I will check that $remote_addr is excaly parametr 1, and i get for
the
url "/80.239.242.1/1"
location ~ ^/([0-9\.]+)/(.*?)$ {
if ($remote_addr != $1) {
echo "$remote_addr != $1";
}
}
And the result is "79.173.35.1 != 80.239.242.1"
The question: Why variable $remote_addr change value when i use "if"
Sorry for my english.
Thanks for reply
Bart
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,233248,233248#msg-233248
on 2012-11-27 03:31
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.