You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by SixArm <si...@gmail.com> on 2006/03/11 19:22:29 UTC

[users@httpd] What EnvVars are available?

I'm trying to add server reply headers to describe the connection to Apache
for tesing purposes.

This is on Apache/2.0.52 on RedHat EL3.

<VirtualHost $ip_alias:$web_server_port>
    DocumentRoot /doc_root
    PassEnv SERVER_ADDR
    PassEnv SERVER_PORT
    PassEnv REMOTE_ADDR
    PassEnv REMOTE_PORT
    PassEnv PATH
    Header set SERVER_ADDR %{SERVER_ADDR}e
    Header set SERVER_PORT %{SERVER_PORT}e
    Header set REMOTE_ADDR %{REMOTE_ADDR}e
    Header set REMOTE_PORT %{REMOTE_PORT}e
    Header set PATH %{PATH}e
</VirtualHost>


The Env Vars are not defined but I can insert a header for PATH.  I can view
all these variable in a simple phpinnfo() call.  I've also written an Apache
1.3 module which accomplishes the same thing.  I was hoping I could
accomplish without an additional module or php.

Can anyone explain why these variable are not available?  Or how I can see
what variables are available.  From what I've read in the Apache docs they
should be available.

Thanks for any help,

-Sixarm

[users@httpd] Re: What EnvVars are available?

Posted by SixArm <si...@gmail.com>.
I managed to get something working.  I'm just not sure if it's the best way
to solve the problem.  I've also noticed that on some of my systems
REMOTE_PORT is blank.  Has anyone else run into this?

Here's the working config:

   RewriteEngine on
   RewriteCond %{REMOTE_ADDR} (.*)
   RewriteRule .* - [E=REMOTE_ADDR:%1]
   RewriteCond %{REMOTE_PORT} (.*)
   RewriteRule .* - [E=REMOTE_PORT:%1]
   RewriteCond %{SERVER_ADDR} (.*)
   RewriteRule .* - [E=SERVER_ADDR:%1]
   RewriteCond %{SERVER_ADDR} (.*)
   RewriteRule .* - [E=SERVER_ADDR:%1]
   RewriteCond %{SERVER_PORT} (.*)
   RewriteRule .* - [E=SERVER_PORT:%1]
   Header set ServerID testcase_1
   Header set SERVER_ADDR %{SERVER_ADDR}e
   Header set SERVER_PORT %{SERVER_PORT}e
   Header set REMOTE_ADDR %{REMOTE_ADDR}e
   Header set REMOTE_PORT %{REMOTE_PORT}e


On 3/11/06, SixArm <si...@gmail.com> wrote:
>
> I'm trying to add server reply headers to describe the connection to
> Apache for tesing purposes.
>
> This is on Apache/2.0.52 on RedHat EL3.
>
> <VirtualHost $ip_alias:$web_server_port>
>     DocumentRoot /doc_root
>     PassEnv SERVER_ADDR
>     PassEnv SERVER_PORT
>     PassEnv REMOTE_ADDR
>     PassEnv REMOTE_PORT
>     PassEnv PATH
>     Header set SERVER_ADDR %{SERVER_ADDR}e
>     Header set SERVER_PORT %{SERVER_PORT}e
>     Header set REMOTE_ADDR %{REMOTE_ADDR}e
>     Header set REMOTE_PORT %{REMOTE_PORT}e
>     Header set PATH %{PATH}e
> </VirtualHost>
>
>
> The Env Vars are not defined but I can insert a header for PATH.  I can
> view all these variable in a simple phpinnfo() call.  I've also written an
> Apache 1.3 module which accomplishes the same thing.  I was hoping I could
> accomplish without an additional module or php.
>
> Can anyone explain why these variable are not available?  Or how I can see
> what variables are available.  From what I've read in the Apache docs they
> should be available.
>
> Thanks for any help,
>
> -Sixarm
>