You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Daniel Aleksandersen <al...@runbox.com> on 2008/04/26 23:33:20 UTC
[users@httpd] SetEnvIf help (concepts OK, but lacks implementation)
Hi,
This is for Apache 2.2.4 and newer. Comments explain what I am trying to
achieve on each step. The coding is just what I think is right, but know not
to be working. Please help me fix the coding.
Help is very appreciated.
SetEnvIfNoCase Host !^www.domain.tld$ wwwhost=no
# Sets enviromental variable wwwhost to no if host is not www.domain.tld
SetEnvIfNoCase Host ^www.aleksandersen.net$ wwwhost=yes
# Sets enviromental variable wwwhost to yes if host is not www.domain.tld
SetEnvIf wwwhost no Header append Vary host
# Appends "host" to Vary header if env. variable wwwhost is no (set above)
SetEnvIf wwwhost no Header always edit Content-Location
^"http://www.domain.tld/"+$
# Edits Content-Location header with regex that is supposed to
add "http://www.domain.tld/" in front of the normal Content-Location header
if variable wwwhost is no (set above) thus creating a absolute URI from a
relative URI
SetEnvIf wwwhost yes Header always unset Content-Location
# Unsets Content-Location header if variable wwwhost is yes (set above)
--
Daniel Aleksandersen
---------------------------------------------------------------------
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] SetEnvIf help (concepts OK, but lacks implementation)
Posted by Daniel Aleksandersen <al...@runbox.com>.
2008-04-27 18:58 skreiv Joshua Slive:
> On Sat, Apr 26, 2008 at 5:33 PM, Daniel Aleksandersen wrote:
> > SetEnvIfNoCase Host !^www.domain.tld$ wwwhost=no
> > # Sets enviromental variable wwwhost to no if host is not www.domain.tld
> > SetEnvIfNoCase Host ^www.aleksandersen.net$ wwwhost=yes
> > # Sets enviromental variable wwwhost to yes if host is not
> > www.domain.tld
> >
> > SetEnvIf wwwhost no Header append Vary host
> > # Appends "host" to Vary header if env. variable wwwhost is no (set
> > above)
>
> You mean:
> SetEnvIfNoCase Host !^www.domain.tld$ nowwwhost
> SetEnvIfNoCase Host ^www.aleksandersen.net$ yeswwwhost
> Header append Vary host env=nowwwhost
>
> and similarly for other conditional header setting.
Thanks for clarifying the syntax! :-)
> (But I'm not positive you can override Content-Location headers like that.)
With Apache 2.4.4 and newer you can unset it when used with “always”. However
it does not work if you negotiate trough a handler such as PHP; because PHP
manipulates the headers too. You will have to unset it both in Apache and in
the PHP file.
Header always unset Content-Location
Could you help me with the regex editing too, please? Were "magical-regex"
takes the current header and inserts "http://www.domain.tld/" as a prefix.
Header always edit Content-Location "magical-regex"
--
Daniel from http://www.opensourcenotebook.com/ the Debian GNU/Linux 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
Re: [users@httpd] SetEnvIf help (concepts OK, but lacks implementation)
Posted by Joshua Slive <jo...@slive.ca>.
On Sat, Apr 26, 2008 at 5:33 PM, Daniel Aleksandersen
<al...@runbox.com> wrote:
> Hi,
>
> This is for Apache 2.2.4 and newer. Comments explain what I am trying to
> achieve on each step. The coding is just what I think is right, but know not
> to be working. Please help me fix the coding.
>
> Help is very appreciated.
>
> SetEnvIfNoCase Host !^www.domain.tld$ wwwhost=no
> # Sets enviromental variable wwwhost to no if host is not www.domain.tld
> SetEnvIfNoCase Host ^www.aleksandersen.net$ wwwhost=yes
> # Sets enviromental variable wwwhost to yes if host is not www.domain.tld
>
> SetEnvIf wwwhost no Header append Vary host
> # Appends "host" to Vary header if env. variable wwwhost is no (set above)
You mean:
SetEnvIfNoCase Host !^www.domain.tld$ nowwwhost
SetEnvIfNoCase Host ^www.aleksandersen.net$ yeswwwhost
Header append Vary host env=nowwwhost
and similarly for other conditional header setting. (But I'm not
positive you can override Content-Location headers like that.)
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