我一直在抓住这个超时问题并希望得到一些帮助.我有一个http请求可能需要2.5分钟才能返回响应.我在Angular中处理超时处理3分钟,NodeJS处理3分钟.我的nginx设置有200秒超时,我的Elastic Load Balancing连接超时设置为4分钟.但是,我一直在2分钟内看到502坏网关nginx 1.4.6(Ubuntu)错误.有没有我错过超时的部分?
我的nginx设置:
server {
listen 80;
server_name;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://localhost:8060;
proxy_redirect off;
proxy_connect_timeout 200s;
proxy_send_timeout 200s;
proxy_read_timeout 200s;
send_timeout 200s;
}
#Handle protected assets using 'internal' directive documented here: https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/
location /protected {
internal;
expires -1;
}
}
Run Code Online (Sandbox Code Playgroud)
我的NodeJS设置正在使用connect-timeout
var timeout = require('connect-timeout');
app.use(timeout(300000));
Run Code Online (Sandbox Code Playgroud)