我正在运行 nginx/ruby-on-ails,我有一个简单的多部分表单来上传文件。
Everything works fine until I decide to restrict the maximum size of files I want uploaded.
为此,我将 nginx client_max_body_size
设置为 1米(1MB) ,并期望在该规则违反时响应 HTTP 413(Request Entity Too Large)状态。
问题 是,当我上传一个1.2 MB 的文件时,浏览器不会显示 HTTP 413错误页面,而是挂起一点,然后会出现一条“当页面加载时连接被重置”的消息。
I've tried just about every option there is that nginx offers, nothing seems to work. Does anyone have any ideas about this?
Here's my 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;
}
}
谢谢。
**Edit**
环境/UA: Windows XP/Firefox 3.6.13