Configuration:<br>
<br>
==========<br>
- Nginx as reverse proxy + SSL negotiation<br>
- Apache Tomcat.<br>
<br>
- nginx version: nginx/1.5.2<br>
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-54)<br>
TLS SNI support disabled<br>
configure arguments: --with-rtsig_module --with-select_module --with-poll_module --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-mail --with-mail_ssl_module --with-cpp_test_module --with-pcre --with-libatomic --with-debug<br>

==========<br>
<br>
<br>
Everything seems to work fine, except for the file upload. For some reason file upload never completes. With the configuration listed below, I am able to upload small files (4K). Upload fails on a 194K file. When I increase "client_body_buffer_size" to 256K, I can upload the 194K file, but a 500K file upload fails. Increasing "client_body_buffer_size" beyond 256K has no impact.<br>

<br>
**Note: When I access Tomcat directly and upload the 500K file, it finishes in a few milliseconds.**<br>
<br>
So, looks like something is wrong with Nginx configuration. Any suggestions are greatly appreciated.<br>
<br>
location / {<br>
root /xyz;<br>
proxy_pass <a href="http://127.0.0.1:9090" target="_blank">http://127.0.0.1:9090</a>;<br>
proxy_redirect off;<br>
proxy_set_header Host $host;<br>
proxy_set_header X-Real-IP $remote_addr;<br>
proxy_set_header X-Forwarded-Server $host;<br>
proxy_intercept_errors on;<br>
<br>
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>
client_max_body_size 500m;<br>
client_body_buffer_size 128k;<br>
proxy_buffering on;<br>
proxy_connect_timeout 75;<br>
proxy_send_timeout 180;<br>
proxy_read_timeout 180;<br>
proxy_buffer_size 128k;<br>
proxy_buffers 4 256k;<br>
proxy_busy_buffers_size 256k;<br>
proxy_temp_file_write_size 64k;<br>
<br>
}<br>
<br>
I have tried adding several other parameters to nginx config (client_body_temp_path, proxy_temp_path, proxy_temp_file_write_size). They didn't seem to help.<br>
<br>
<br>
====<br>
<br>
<br>***** <span></span>Further investigation revealed that we have problem uploading 196K file and upwards. 194K file works. "client_body_buffer_size" value is set to 256K.<br>
<br>
Nginx debug logs show the following in case of failue:<br>
===========<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 recv: fd:11 2606 of 16384<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy status 200 "200 OK"<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy header: "Server: Apache-Coyote/1.1"<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy header: "Content-Type: text/html;charset=utf-8"<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy header: "Date: Tue, 30 Jul 2013 22:29:57 GMT"<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy header: "Connection: close"<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy header done<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 xslt filter header<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 HTTP/1.1 200 OK^M<br>
Server: nginx/1.5.2^M<br>
Date: Tue, 30 Jul 2013 22:29:57 GMT^M<br>
Content-Type: text/html;charset=utf-8^M<br>
Transfer-Encoding: chunked^M<br>
Connection: keep-alive^M<br>
<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 write new buf t:1 f:0 000000001E61DAD8, pos 000000001E61DAD8, size: 168 file: 0, size: 0<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http write filter: l:0 f:0 s:168<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http cacheable: 0<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 posix_memalign: 000000001E62D450:4096 @16<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http proxy filter init s:200 h:0 c:0 l:-1<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http upstream process upstream<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 pipe read upstream: 1<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 pipe preread: 2465<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 readv: 1:13778<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 readv() not ready (11: Resource temporarily unavailable)<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 pipe recv chain: -2<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 pipe buf free s:0 t:1 f:0 000000001E61DBD0, pos 000000001E61DC5D, size: 2465 file: 0, size: 0<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 pipe length: -1<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 pipe write downstream: 1<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 pipe write busy: 0<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 pipe write: out:0000000000000000, f:0<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 pipe read upstream: 0<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 pipe buf free s:0 t:1 f:0 000000001E61DBD0, pos 000000001E61DC5D, size: 2465 file: 0, size: 0<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 pipe length: -1<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 event timer add: 11: 180000:1375223577332<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http upstream request: "/upload/html?"<br>
2013/07/30 16:29:57 [debug] 14208#0: *1 http upstream send request handler<br>
2013/07/30 16:29:57 [debug] 14208#0: timer delta: 6<br>
2013/07/30 16:29:57 [debug] 14208#0: posted events 0000000000000000<br>
2013/07/30 16:29:57 [debug] 14208#0: worker cycle<br>
2013/07/30 16:29:57 [debug] 14208#0: epoll timer: 179994<br>
=================<br>
<br>
<br>
I notice "http upstream send request handler" in above log snippet, where as in success case, I see this:<br>
2013/07/30 16:29:44 [debug] 14208#0: *1 http upstream dummy handler<br>
<br>
<br>
Any idea what "http upstream send request handler" and "http upstream dummy handler" mean, and what they signify?<br>