Under tornado v4+ WebSocket connections get refused with 403

前端 未结 2 1518
孤城傲影
孤城傲影 2021-01-31 12:01

I have an older tornado server that handles vanilla WebSocket connections. I proxy these connections, via Nginx, from wss://info.mydomain.com to wss://mydomain.com:8080 in order

2条回答
  •  有刺的猬
    2021-01-31 12:29

    I would like to propose and alternative solution, instead of messing with the tornado application code, I solved the issue by telling nginx to fix the host header:

    location /ws {
    proxy_set_header Host $host;
    proxy_pass http://backend;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    }
    

提交回复
热议问题