LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > General > [solved] SetEnvIf Alternative

Reply
 
Thread Tools Display Modes
  #1  
Old 10-08-2012, 11:35 AM
ballotcan ballotcan is offline
New Member
 
Join Date: Oct 2012
Posts: 4
Default [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?

Last edited by NiteWave; 10-10-2012 at 06:16 PM..
Reply With Quote
  #2  
Old 10-08-2012, 08:20 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
you can use a rewrite rule to do the same thing.
Reply With Quote
  #3  
Old 10-10-2012, 03:07 AM
ballotcan ballotcan is offline
New Member
 
Join Date: Oct 2012
Posts: 4
Quote:
Originally Posted by mistwang View Post
you can use a rewrite rule to do the same thing.
any example?
Reply With Quote
  #4  
Old 10-10-2012, 03:26 AM
NiteWave NiteWave is online now
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
per the link you provided, CF-IPCountry is a request header.

RewriteCond %{HTTP:CP-IPCountry} ^(CN|RU|IN)$
RewriteRule .* - [F,L]
Reply With Quote
  #5  
Old 10-10-2012, 04:12 AM
ballotcan ballotcan is offline
New Member
 
Join Date: Oct 2012
Posts: 4
Quote:
Originally Posted by NiteWave View Post
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
sometimes i need access to server without cloudflare protection and there won't be CP-IPCountry header
Reply With Quote
  #6  
Old 10-10-2012, 05:05 AM
NiteWave NiteWave is online now
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
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 ?
Reply With Quote
  #7  
Old 10-10-2012, 06:43 AM
ballotcan ballotcan is offline
New Member
 
Join Date: Oct 2012
Posts: 4
Quote:
Originally Posted by NiteWave View Post
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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.