You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Belov, Charles" <Ch...@sfmta.com> on 2011/02/05 04:04:42 UTC

[users@httpd] mod_headers not echoing environment variables

In response to a request for the file:
http://www.sfmta.com/cms/cmta_test/documents/3-18-08CurrentFares_test.pd
f?abc
with the following directive in .htaccess in the same folder

Header set Location "http://%{SERVER_NAME}e%{REQUEST_URI}e"

httpd 2.2 is serving the following header:

Location: http://(null)(null)

How do I get these two variables into my header so that the header reads

Location:
http://www.sfmta.com/cms/cmta_test/documents/3-18-08CurrentFares_test.pd
f

(without the ?abc)

The documentation for mod_headers doesn't list the specific environment
variables that it supports; I got SERVER_NAME and REQUEST_URL from the
mod_rewrite documentation (although apparently mod_headers requires the
trailing e and mod_rewrite doesn't).

I checked the FAQ.  Nothing related.

A Google search for this issue turned up the same issue for Apache 2.2,
in which someone  got (null) in place of a desired environmental
variable.  Someone suggested adding RewriteEngine On above the header
command.  I tried that with no change in results.

Thanks for any assistance.

Charles Belov
SFMTA Webmaster



---------------------------------------------------------------------
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] mod_headers not echoing environment variables

Posted by Eric Covener <co...@gmail.com>.
On Fri, Feb 4, 2011 at 10:04 PM, Belov, Charles <Ch...@sfmta.com> wrote:
> In response to a request for the file:
> http://www.sfmta.com/cms/cmta_test/documents/3-18-08CurrentFares_test.pd
> f?abc
> with the following directive in .htaccess in the same folder
>
> Header set Location "http://%{SERVER_NAME}e%{REQUEST_URI}e"

Those aren't environment variables.  You might be able to use setenvif
or rewriterule to copy variables they know how to interpolate into
regular environment variables.

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