You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Lucas Brasilino <lu...@gmail.com> on 2007/02/09 19:20:41 UTC

[users@httpd] How to SetEnvIf matching previous matches

Hi all:

I'm trying to make a 'AND' beetween two 'SetEnvIf' matches
with no success. In mod_setenv docs it says that the
'attribute' field can be the name of an enviroment variable
of a previous match. I've tried many configurations with no
success. Maybe I'm misunderstading the docs...

SetEnvIf Request_URI "\.pdf$" IS_pdf
BrowserMatch MSIE IS_ie


How can I make a 'AND' beetween 'IS_pdf' and 'IS_ie'
to set 'Pragma_NoCache' and do a:

Header set Pragma "no-cache" env=Pragma_NoCache


Thanks a lot in advance
Lucas Brasilino

---------------------------------------------------------------------
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] How to SetEnvIf matching previous matches

Posted by Krist van Besien <kr...@gmail.com>.
On 2/9/07, Lucas Brasilino <lu...@gmail.com> wrote:
> Hi all:
>
> I'm trying to make a 'AND' beetween two 'SetEnvIf' matches
> with no success. In mod_setenv docs it says that the
> 'attribute' field can be the name of an enviroment variable
> of a previous match. I've tried many configurations with no
> success. Maybe I'm misunderstading the docs...
>
> SetEnvIf Request_URI "\.pdf$" IS_pdf
> BrowserMatch MSIE IS_ie
>
>
> How can I make a 'AND' beetween 'IS_pdf' and 'IS_ie'
> to set 'Pragma_NoCache' and do a:
>
> Header set Pragma "no-cache" env=Pragma_NoCache

As far as I know you can't do boolean logic in SetEnvIf request. There
is workaround however. I had a similar problem, where I needed to set
a header based on the presence of two other headers. The trick was to
use a ReWriteRule, but solely for its side effects, not rewriting any
URLS. The advantage is that you can AND and OR several ReWriteCond
statements, but in your case you would only need one, as you can doe
the URI machting in the ReWriteRule itself:

ReWritecond  ยง{HTTP_USER_AGENT}  MSIE
ReWriteRule    ^(.*\.pdf)$    $1      [E:Pragma_NoCache=yes]

Header set Pragma "no-cache" env=Pragma_NoCache

Krist

-- 
krist.vanbesien@gmail.com
Bremgarten b. Bern, Switzerland
--
"...what you don't realize is that in the future Google WILL reach
sentience, will [have had] invent[ed] a time machine, and will [have
had] travel[ed] back in time to prevent Bill Gates... only to become
Bill Gates by accident because of a search engine optimization
miscalculation." (Comment on the Dilbert Blog)

---------------------------------------------------------------------
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