LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   General (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=25)
-   -   [solved] SetEnvIf Alternative (http://www.litespeedtech.com/support/forum/showthread.php?t=6304)

ballotcan 10-08-2012 11:35 AM

[solved] SetEnvIf Alternative
 
Hi I'm using cloudflare + litespeed

Code:

SetEnvIf CF-IPCountry CN BuzzOff=1
 SetEnvIf CF-IPCountry RU BuzzOff=1
 SetEnvIf CF-IPCountry IN BuzzOff=1
 Order allow,deny
 Allow from all
 Deny from env=BuzzOff

just tried that as said as this site : http://www.asiteaboutnothing.net/c_block-countries.html

any way to use this header for block access? :confused:

mistwang 10-08-2012 08:20 PM

you can use a rewrite rule to do the same thing.

ballotcan 10-10-2012 03:07 AM

Quote:

Originally Posted by mistwang (Post 35343)
you can use a rewrite rule to do the same thing.

any example?

NiteWave 10-10-2012 03:26 AM

per the link you provided, CF-IPCountry is a request header.

RewriteCond %{HTTP:CP-IPCountry} ^(CN|RU|IN)$
RewriteRule .* - [F,L]

ballotcan 10-10-2012 04:12 AM

Quote:

Originally Posted by NiteWave (Post 35369)
per the link you provided, CF-IPCountry is a request header.

RewriteCond %{HTTP:CP-IPCountry} ^(CN|RU|IN)$
RewriteRule .* - [F,L]

Thanks this works but how can i bypass this rewrite rule if there is no CP-IPCountry :confused:
sometimes i need access to server without cloudflare protection and there won't be CP-IPCountry header

NiteWave 10-10-2012 05:05 AM

Quote:

sometimes i need access to server without cloudflare protection and there won't be CP-IPCountry header
then how do you know the IP is from which country ?

ballotcan 10-10-2012 06:43 AM

Quote:

Originally Posted by NiteWave (Post 35371)
then how do you know the IP is from which country ?

i cant know

RewriteCond %{HTTP:CP-IPCountry} !^(DE|NL|)$
RewriteRule .* - [F,L]

this worked


All times are GMT -7. The time now is 04:32 PM.