Upload file to PHP (Socket FastCGI) behind reserve proxy issue.

hshh hunreal at gmail.com
Sat Jun 13 09:29:54 MSD 2009


Hi,

I just found an interesting bug about file upload to php behind
reserve proxy, and only effect by using socket mode.

Short describe about environment, Client <--> NAT <--> Nginx Reserve
Proxy (A) <--> Nginx Web (B1) <--> PHP FastCGI (B2). All server OS,
FreeBSD 7.2-RELEASE AMD64, Proxy is running on server A, Web and PHP
are running on server B.

If B1 communicate B2 with socket mode, the client file upload will be
randomly fail. By used ``truss'' to trace php process, I found php is
stuck after the first 8k input data, but client, server A, server B1
still processing upload data transfer. So client browser also stuck
after full file data uploaded to proxy/web, but except php fastcgi,
until proxy or web or php timeout, depend on  their timeout setting.

If B1 with B2 using TCP/IP connection, I can't repeat the problem, I
think there is no issue on TCP mode. Because TCP mode, I can tcpdump
on lo0 loopback interface. Tcpdump show me, B1 will buffer POST data,
and send to FastCGI at once after client side upload finished.

It's said that, socket fastcgi, is synchronous data transfer, or flush
echo 8k buffer depend on nginx config or OS?





More information about the nginx mailing list