NGINX пишет вот такую ошибку "16762#16762: *1 upstream prematurely closed connection while reading response header from upstream, client: 85.XXX.XXX.167, server: call.123.ru, request: "GET /connect/?EIO=4&transport=polling&t=Nh8R_fa HTTP/1.1", upstream: "
10.7.156.236:6445/connect/?EIO=4&transport=polling...", host: "call.123.ru", referrer: "
https://call.123.ru/"" я уже какие только параметры для proxy не поперепробывал, ошибка остается. В чем может быть причина, раньше все прекрасно работало, спустя год снова вернулся к socket и на тебе, не хочет.
nginx
location /connect/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://socket_call;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
node server
const https = require('https');
const server = https.createServer().listen(6445);
const io = require("socket.io")(server, {
"path": "/connect"
//"wsEngine": require("eiows").Server
});
io.on("connection", (socket) => {
console.log(socket.id);
socket.on("data", (data) => {
console.log(data);
});
socket.on("disconnect", (data) => {
console.log(data);
});
});
js client
<script src="https://cdn.socket.io/4.1.2/socket.io.min.js" integrity="sha384-toS6mmwu70G0fw54EGlWWeA4z3dyJ+dlXBtSURSKN4vyRFOcxd3Bzjj/AoOwY+Rg" crossorigin="anonymous"></script>
<body>
<script>
const socket = io("https://call.123.ru", {path: "/connect/"});
socket.emit("data", JSON.stringify({ 'index': '123' }))
</script>
</body>