码迷,mamicode.com
首页 > Web开发 > 详细

nginx反向代理 报错:Error during WebSocket handshake: Unexpected response code: 403

时间:2019-11-27 00:47:49      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:代理   upstream   pst   sockets   socket   浏览器   version   升级   hand   

遇到nginx报错:websocket wss failed: Error during WebSocket handshake: Unexpected response code: 403

  server {
    listen 6340;
    location / {
      proxy_pass http://web;
      proxy_http_version 1.1;        #Nginx在与Node后端通信时使用HTTP/1.1,是WebSockets所必需的
      proxy_set_header Origin '';
      proxy_set_header Upgrade $http_upgrade;    #Nginx响应升级请求,当浏览器想要使用WebSocket时,该请求由HTTP启动
      proxy_set_header Connection "Upgrade";
    }
  }

代理 TCP和UDP

stream {
  upstream pptcp {
    server 10.10.10.10:9994;
    server 10.10.10.11:9994;
    }
  server {
    listen 9994;
    proxy_pass pptcp;
    proxy_connect_timeout 10s;
    proxy_timeout 3h;
    }
  upstream ppudp {
    server 10.10.10.10:9995;
    server 10.10.10.11:9995;
    }
  server {
    listen 9995 udp;
    proxy_pass ppudp;
    proxy_connect_timeout 10s;
    proxy_timeout 3h;
    }
  }

nginx反向代理 报错:Error during WebSocket handshake: Unexpected response code: 403

标签:代理   upstream   pst   sockets   socket   浏览器   version   升级   hand   

原文地址:https://www.cnblogs.com/fan-gx/p/nginx.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!