Re: [users@httpd] negative regex in SetEnvIf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/9/06, Proniewski Patrick <patrick.proniewski@xxxxxxxxxxxxx> wrote:
On 9 juin 06, at 14:32, Joshua Slive wrote:

>> # will not work...
>> BrowserMatch !Firefox not_fx
>
> There is no direct support for this, but you can often reverse the
> logic and cause the regex to unset and env variable instead and then
> use the lack of the variable as a trigger for whatever you were trying
> to do.

Yes, we've explored this a little bit yesterday with the syntax:

SetEnvIf Request_URI .* GoAway=1
BrowserMatch .+ !GoAway
SetEnvIf Referer .+ !GoAway
Deny from env=GoAway

that means "deny every client that comes with blank user-agent AND
with blank referer" (do no deny every client that comes either with a
non-blank client, or with a non-blank referer)

It's easy, because ".+" is the negation of "^$", so I don't have to
use something like "!^$" (which wouldn't work)
I think it's becoming more complicated if I want the opposite of a
particular value.

for example: "deny every client that comes with Firefox AND with
blank referer" (do no deny every client that comes either with a non-
firefox client, or with a non-blank referer)

may be I'm missing something obvious...

I could probably come up with a way to do this with mod_setenvif, but
when your config crosses a certain level of complexity, it is usually
easier to just bite the bullet and pull out mod_rewrite.  It has a
much more flexible config syntax and therefore can sometimes express
these things much more clearly.

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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux