Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.htaccess block the true client not the proxy ip

Status
Not open for further replies.

SM777

Technical User
Mar 7, 2001
208
GB
How can I get .htaccess to block a clients true IP address? It only seems to block the proxy ip.

e.g. Joe is using his ISP's proxy server 80.80.80.80. His true IP address (as indicated in X_FORWARDED_FOR) is 80.123.123.123. What I want to do is to block the 80.123.123.123

But .htaccess doesn't do this. It doesn't block 80.123.123.123 as this address is the X_FORWARDED_FOR IP and not the host_ip

I can't block 80.80.80.80 as this would block out thousands of users.

 
Top.

Am I barking up the wrong tree here? Or is my request not possible?

recap: block on X_FORWARDED_FOR IP address in .htaccess.

Cheers.

 
Ok. I guess its not possible.

º¿º

 
This .htaccess should work:
SetEnvIf X-Forwarded-For ^bad.ip.add.ress$ badclient
Order Allow,Deny
Allow from all
Deny from all env=badclient
This requires that you have mod_access and mod_setenvif loaded into your server. //Daniel
 
1.3.26.

The SetEnvif solution looks good. I'll give it a try.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top