http - nginx upload client_max_body_size issue -


i'm running nginx/ruby-on-rails , have simple multipart form upload files. works fine until decide restrict maximum size of files want uploaded. that, set nginx client_max_body_size 1m (1mb) , expect http 413 (request entity large) status in response when rule breaks.

the problem when upload 1.2 mb file, instead of displaying http 413 error page, browser hangs bit , dies "connection reset while page loading" message.

i've tried every option there nginx offers, nothing seems work. have ideas this?

here's nginx.conf:

worker_processes  1; timer_resolution  1000ms; events {     worker_connections  1024; }  http {     passenger_root /the_passenger_root;     passenger_ruby /the_ruby;      include       mime.types;     default_type  application/octet-stream;      sendfile           on;     keepalive_timeout  65;      server {       listen 80;       server_name www.x.com;       client_max_body_size 1m;       passenger_use_global_queue on;       root /the_root;       passenger_enabled on;        error_page 404 /404.html;       error_page 413 /413.html;         }     } 

thanks.


**edit**

environment/ua: windows xp/firefox 3.6.13

nginx "fails fast" when client informs it's going send body larger client_max_body_size sending 413 response , closing connection.

most clients don't read responses until entire request body sent. because nginx closes connection, client sends data closed socket, causing tcp rst.

if http client supports it, best way handle send expect: 100-continue header. nginx supports correctly of 1.2.7, , reply 413 request entity large response rather 100 continue if content-length exceeds maximum body size.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -