header passed to fastcgi

Maxim Dounin mdounin at mdounin.ru
Wed Jul 29 16:01:48 MSD 2009


On Wed, Jul 29, 2009 at 01:26:51PM +0200, Daniele Melosi wrote:

> Hi all,
> I notice that nginx when pass header to fastcgi add "HTTP_" at the  
> beginning even if HTTP_ is already present like in the example below:
> $ curl "" --header "Host: localhost"  
> --header "HTTP_TM_USER_ID: 36" --connect-timeout 3 | grep HTTP_TM_USER_ID
> <tr><td class="e">_SERVER["HTTP_HTTP_TM_USER_ID"]</td><td  
> class="v">36</td></tr>
> <tr><td class="e">_ENV["HTTP_HTTP_TM_USER_ID"]</td><td  
> class="v">36</td></tr>
> Is it possible to avoid this and pass the header "as is" ?

Prefix HTTP is used to make sure arbitrary http headers can't 
override environment.  Not using prefix if header already starts 
with 'HTTP' will make headers with and without 'http' prefix 

And, actually, it's not nginx decision, and not even php decision 
(it's php passes headers to your script, not nginx).  It's defined 
this way in CGI specs, see


for details.

Maxim Dounin

More information about the nginx mailing list