Welcome! Log In Create A New Profile

Advanced

Block users behind proxy

Posted by lukasamd 
Block users behind proxy
February 01, 2012 09:58AM
Hello,
I migrated from Apache to nginx and I have a small problem.
I'ld like to block users behind proxies or users which use "strange" headers. Of course it's impossible to block all, but in Apache I could use that:

RewriteCond %{HTTP:VIA} !^$ [OR]
RewriteCond %{HTTP:FORWARDED} !^$ [OR]
RewriteCond %{HTTP:USERAGENT_VIA} !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_FOR} !^$ [OR]
RewriteCond %{HTTP:PROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:XPROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
RewriteCond %{HTTP:HTTP_CLIENT_IP} !^$
RewriteRule ^(.*)$ - [F]

Is it possible to make similar rewrites/conditions for nginx? I read about Access and Geo Modules, but I don't sure what should I use.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 302
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready