You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "\"Crash\" Dummy" <gm...@thedatalist.com> on 2007/08/04 19:30:57 UTC

[users@httpd] Re: Set Environment for range of addresses

> SetEnvIf accepts only regular expressions, not CIDR notation.
> Fortunately, most groups of IP addresses can be expressed with regexes
> (although often with a little more effort). What you want is simple:

> SetEnvIf Remote_Addr ^192\.168\. dontlog

Ah, thank you! I am a newbie, and "regexes" still scare me, paricularly the
strange syntax. For example, why would that one start with "^" but not end with
"$" like many do?
-- 
Crash





---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Re: Set Environment for range of addresses

Posted by "\"Crash\" Dummy" <gm...@thedatalist.com>.
> Google for regular expressions and you'll find tons of tutorials.

I did, and I did. Got the reference from Perl. Thanks.
-- 
Crash




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Set Environment for range of addresses

Posted by Joshua Slive <jo...@slive.ca>.
On 8/4/07, Crash Dummy <gm...@thedatalist.com> wrote:
> > SetEnvIf accepts only regular expressions, not CIDR notation.
> > Fortunately, most groups of IP addresses can be expressed with regexes
> > (although often with a little more effort). What you want is simple:
>
> > SetEnvIf Remote_Addr ^192\.168\. dontlog
>
> Ah, thank you! I am a newbie, and "regexes" still scare me, paricularly the
> strange syntax. For example, why would that one start with "^" but not end with
> "$" like many do?

Google for regular expressions and you'll find tons of tutorials.

The ^ indicates that the match must start at the beginning of the
Remote_Addr. Since I don't know what is going to be at the end, I
don't care about the last part and therefore don't use $ to indicate
that the match finishes at the end of Remote_Addr. I could have
equivalently (but less efficiently) used ^192\.168\..*$ to indicate
that I'll accept anything at all after the 192.168 up to the end of
the Remote_Addr.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org