httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <>
Subject Re: [users@httpd] Question about RequestHeader and Apache's use of Environment Variables
Date Thu, 01 Jul 2004 18:28:11 GMT
On Thu, 1 Jul 2004 12:51:58 -0400, Brian V Hughes <> wrote:
> No, on to my problem: My embedded web server (UserLand Frontier, for
> those that might care), has a need to know the IP address of the client
> and the name of the host, both of which are very easy to obtain from
> the HTTP request headers. However, I also need to be able to access the
> REMOTE_PORT of the client, in order to make an authentication call back
> to the client machine. I found mod_headers and the RequestHeader
> directive, and found the syntax for including an environment variable.
> But, much to my surprise, I find that not only will RequestHeader not
> include the value of any environment variables, including things like
> HTTP_USER_AGENT, but that Apache doesn't even makethe environment
> variables available for modules to use. Access appears to be module
> specific (i.e. mod_cgi and mod_rewrite (as of 2.0.49) can both access
> REMOTE_PORT), rather than system wide.

First, the ability to use %e in RequestHeader is a very recent feature
addition.  It is not documented in 2.0, and I haven't checked the
code, so it may only be available in the dev version (2.1).

Second, most of the things we think of as CGI env variables only
really become env variables when a CGI script or SSI page is called. 
Modules like mod_rewrite access this information directly from
internal apache structures not from env variables.  But if mod_rewrite
can access it, you can convert it to an env variable, using something

RewriteCond %{REMOTE_PORT} (.*)
RewriteRule .* - [E=R_P:%1]

RequestHeader add R-P %{R_P}e

But, as I said, I don't think this will work in any 2.0 version.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message