Nginx proxy\u pass websocket超时,尽管设置了读取超时
因此,我们需要将Nginx proxy\u pass websocket超时,尽管设置了读取超时,nginx,websocket,timeout,proxypass,Nginx,Websocket,Timeout,Proxypass,因此,我们需要将nginx中前往/notifications的任何流量代理给AWS ALB 如果我们直接向ALB创建websocket,它将在3:10秒后关闭,这就是我们配置的超时 然而,当我们尝试从前端代理传递时,我们不能得到大于60秒的超时。我几乎遵循了我能找到的关于这件事的每一条线索,下面是我们的配置: location /notifications/internal/ { rewrite ^/notifications/internal /notinternal
nginx
中前往/notifications
的任何流量代理给AWS ALB
如果我们直接向ALB创建websocket,它将在3:10秒后关闭,这就是我们配置的超时
然而,当我们尝试从前端代理传递时,我们不能得到大于60秒的超时。我几乎遵循了我能找到的关于这件事的每一条线索,下面是我们的配置:
location /notifications/internal/ {
rewrite ^/notifications/internal /notinternal last;
}
location /notifications {
rewrite ^/notifications(/|$)(.*) /$2 break;
proxy_pass https://ALB;
proxy_pass_request_headers on;
proxy_read_timeout 3600s;
proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
send_timeout 3600s;
proxy_socket_keepalive on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
60年代之后,我们总是看到这样的日志:
10.31.0.22 - - [14/May/2020:13:15:16 +0000] "GET /notifications/ws HTTP/1.1" response 101 body-bytes 100 upstream_resp_time 60.002 req_time 60.001 req_bytes 373 vhost x.x country - cf_connecting_ip - cf_ray -
我曾尝试在nginx.conf
中添加更大的超时,但似乎没有任何效果
我尝试将代理传递放入上游块,但它似乎不起作用,我得到404未找到
现在我知道nginx在这方面起了一定作用,就好像我将超时设置为5s一样,我确实得到了早期超时,有些东西不允许它超过1分钟。这里的问题是,我们的前端也在ALB后面,超时设置为60秒。我觉得很傻