You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by A D <an...@hotmail.fr> on 2010/12/14 15:28:58 UTC

[users@httpd] environment variables manipulation in httpd.conf

Hello,

  

I've just recompiled a apache 2.2.17 on linux with all
modules in shared. I'm trying to add headers containing apache
"environment variables" like SERVER_NAME, HTTP_USER_AGENT with
mod_headers.



I always get null in my headers. 

 

 

The response from server contains the header but I'm
unable to put inside any env variables



The only thing that works is the %D and %t for time.

 

I'm probably missing something but I can not figure what
I'm doing wrong. 

Here is an extract of th httpd.conf

  


 

LoadModule env_module modules/env_headers.so





LoadModule headers_module modules/mode_headers.so

LoadModule ident_module modules/mode_ident.so





LoadModule unique_id_module modules/mode_unique_id.so



LoadModule setenvif_module modules/mode_setenvif.so

LoadModule rewrite_module modules/mode_rewrite.so



  


ServerName Server



 

Listen 8080


 

Header add TOTO "%D %t %{SERVER_NAME}e"

  


NameVirtualHost *:8080

 <VirtualHost *:8080>

 DocumentRoot /usr/local/apache/htdocs"

 ServerName Server

 Header add TUTU "%D 
%t  %{SERVER_NAME}e"

</VirtualHost>

 

 

With this conf I get TUTU D=xxxxxx t=ttttttt null It is
the same with every variables. Same with headers TOTO. It is like the environment variables are not available outside a cgi programm


Thanks in advance

 


 		 	   		  
---------------------------------------------------------------------
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] environment variables manipulation in httpd.conf

Posted by A D <an...@hotmail.fr>.
There is something very strange with these variables.
For example I can logged SERVER_NAME in the log file thus there is really something that I do not understand. How the same variable can be expansed for logging but in the same time be unavailable for creating a header...

I have not find any list in documentation describing the scope of availabilty of each variables. I do not have seen either a list of variable from apache docs. It seems to spread among the modules documentations

----------------------------------------
> Date: Tue, 14 Dec 2010 09:57:53 -0500
> From: covener@gmail.com
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] environment variables manipulation in httpd.conf
>
> On Tue, Dec 14, 2010 at 9:51 AM, A D  wrote:
> >
> > Thanks for quick the response.
> > I do not have seen any explanation about the variables and when they are available in the documentation.
> > Is there any solution to have them available everywhere ie outside a cgi.
>
> Modules like setenvif or mod_rewrite might might let you expose
> various internal data as environment variables.
>
> Does the manual say SERVER_NAME should be available in the environment?
>
> --
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See  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
>
 		 	   		  
---------------------------------------------------------------------
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] environment variables manipulation in httpd.conf

Posted by Eric Covener <co...@gmail.com>.
On Tue, Dec 14, 2010 at 9:51 AM, A D <an...@hotmail.fr> wrote:
>
> Thanks for quick the response.
> I do not have seen any explanation about the variables and when they are available in the documentation.
> Is there any solution to have them available everywhere ie outside a cgi.

Modules like setenvif or mod_rewrite might might let you expose
various internal data as environment variables.

Does the manual say SERVER_NAME should be available in the environment?

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] environment variables manipulation in httpd.conf

Posted by A D <an...@hotmail.fr>.
Thanks for quick the response.
I do not have seen any explanation about the variables and when they are available in the documentation. 
Is there any solution to have them available everywhere ie outside a cgi. 

Regards


----------------------------------------
> Date: Tue, 14 Dec 2010 09:43:02 -0500
> From: covener@gmail.com
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] environment variables manipulation in httpd.conf
>
> > It is like the environment variables are not available outside a cgi program
>
> This is the case for many environment variables.
>
> --
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See  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
>
 		 	   		  
---------------------------------------------------------------------
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] environment variables manipulation in httpd.conf

Posted by Eric Covener <co...@gmail.com>.
On Tue, Dec 14, 2010 at 9:43 AM, Eric Covener <co...@gmail.com> wrote:
>> It is like the environment variables are not available outside a cgi program
>
> This is the case for many environment variables.

Should note that if the request is CGI or (mod_include which also sets
them) then the variables hang along enough to be logged as well.
-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] environment variables manipulation in httpd.conf

Posted by Eric Covener <co...@gmail.com>.
> It is like the environment variables are not available outside a cgi program

This is the case for many environment variables.

-- 
Eric Covener
covener@gmail.com

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