[error] 11709#11709: *53 upstream prematurely closed connection while reading response header from upstream,
这是我得到的错误。
server {
server_name ....;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/......;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
location /ws/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_pass http://127.0.0.1:8001;
}
}
我正在使用来自 chrome 的以下客户端应用程序:
var exampleSocket = new WebSocket("wss://....../ws/.....")
exampleSocket.onopen = function (event) {
console.log("Here's some text that the server is urgently awaiting!");
};
可能的错误是什么,我无法调试它。我想使用 websocket 和 django-channels 发送通知,但每次我请求服务器时,它都会给我 502 错误。