1 message in ru.sysoev.nginxHeaders not passed from authorizer PH...
FromSent OnAttachments
Just MarcSep 26, 2007 4:37 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Headers not passed from authorizer PHP scriptActions...
From:Just Marc (marc@public.gmane.org)
Date:Sep 26, 2007 4:37:38 am
List:ru.sysoev.nginx

Hi,

I have the following scenario. This is what happens under normal circumstances:

1. A client request is received and rewritten/forwarded to an authorizer PHP script via fastcgi. The script sets: X-Accel-Redirect, and another private session header.

2. nginx sends the file to the client

3. Once nginx is done sending the file, I have a module that reads the private session header added by the PHP script and acts accordingly (it knows which transfer was made and by whom, by reading the private session id header, it then does some accounting).

---

Now, in some cases I found that the module receives an empty session header value (in fact, it receives no headers at all set by the PHP script) while I verified that the PHP script ran fully in these cases. Nginx wrote a log line about connection as having error code 499.

In order to operate, my module must receive the session id header that was set by the authorizer PHP script and do proper cleanup and accounting.

The way to reproduce this scenario is as follows:

1. Add a sleep of a few seconds to the authorizer PHP script. 2. Issue a request using wget to the URL handled by the script. 3. Once the script is 'stuck' on that sleep, break wget with ctrl-c.

I know the script finishes running fully, the connection gets code 499, and the module will not see any headers set by the PHP script for this connection.

Before writing the module, I also tried a PHP script that's run by post_action. In this case, breaking the wget connection while the first (authorizer) PHP script is in 'sleep', post_action is not executed at all.

Any hints would be greatly appreciated!

Marc