Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this web service that's running on nginx and fastcgi(php-fpm). The web service is used by some embeded http clients which will need to send some arbitrary http request headers when they are using the service. For example:

CLIENT_ID: client1

or something like that.

I'm not sure if this kind of request will be captured by nginx when it arrives. If so, how would nginx store the values of the extra HTTP headers? And how to tell nginx to pass the parameters to php?

I have already tried to put

fastcgi_param CLIETN_ID $client_id 

into conf/fastcgi_params configuration file, I supposed this will help nginx to store what's in CLIENT_ID as the $client_id param. I also put

fastcgi_param CLIENT_ID $client_id

simply to fetch what's stored in $client_id and pass it to php as keyed 'CLIENT_ID', so php can access it with $_SERVER['CLIENT_ID'].

Unfortunately the above didn't work out. When I do

nginx -t 

I got the error "unknow parameter client_id". Where did I get it wrong and how to fix it?

Thank you.

share|improve this question
up vote 2 down vote accepted

Request headers are assigned variables starting with $http_, so a request header of Client-Id would be stored in $http_client_id. try

fastcgi_param CLIENT_ID $http_client_id;

I'm pretty sure that nginx already passes along all http headers, so it may already be available as $_SERVER['HTTP_CLIENT_ID']

share|improve this answer

Did you check if the headers are visible in the $_SERVER superglobal? I suspect this might "just work" without you having to do anything.

share|improve this answer
nope, can't reload nginx due to the error. – Shawn Apr 12 '11 at 1:49
Er, I meant without your extra nginx config settings. Also, try using: $http_client_id. See – devicenull Apr 12 '11 at 1:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.