Block Proxy Server's Traffic in Dedicated Server

umysql

Member
Jul 24, 2015
6
0
1
India
cPanel Access Level
Root Administrator
Hello,
i have whm/cPanel Server, and hosted website.
i have some forms in webportal, some visitors doing malicious activity with that, i have blocked there IP by CSF but, they can access my portal via proxy.
is there any way to block proxy traffic automatically in to my server ?
 

24x7server

Well-Known Member
Apr 17, 2013
1,911
96
78
India
cPanel Access Level
Root Administrator
Twitter
Hello :),

You can block proxy access for your site by using following code in .htaccess file.

Code:
RewriteEngine on
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]
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
Hello :)

Keep in mind that you risk blocking some legitimate traffic if you decide to block all proxy access to your server.

Thank you.