NGINX Websocket 302 (redirect) error



http://prntscr.com/coliya -Chromehttp://prntscr.com/coljez歌剧

NGINX

  server {
  listen 0.0.0.0:80;
  listen 0.0.0.0:443 ssl;
  root /usr/share/nginx/html;
  index index.html index.htm;
  ssl on;
  sslcertificate /etc/ssl/certs/ssl-bundle.crt;
  sslcertificatekey /etc/ssl/private/budokai-onlinecom.key;
  sslciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-        SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kED$
  ssldhparam /etc/ssl/private/dhparmas.pem;
  sslpreferserverciphers on;
  sslprotocols TLSv1 TLSv1.1 TLSv1.2;
  if ($sslprotocol = "") {
  rewrite ^ https://$host$requesturi? permanent;
  }
 largeclientheader_buffers 8 32k;
 location / {
 proxyhttpversion 1.1;
 proxysetheader Accept-Encoding "";
 proxysetheader X-Real-IP $remoteaddr;
 proxysetheader Host $host;
 proxysetheader X-Forwarded-For $proxyaddxforwardedfor;
 proxysetheader XFORWARDEDPROTO https;
 proxysetheader X-NginX-Proxy true;
 proxybuffers 8 32k;
 proxybuffersize 64k;
 proxysetheader Upgrade $httpupgrade;
 proxysetheader Connection "Upgrade";
 proxyreadtimeout 86400;
 proxypass http://budokai-online.com:8080 ;
}

我遇到的问题是,当试图连接到websocket时,一些计算机和一些浏览器正在被重定向。当出现302错误时,表示"/*"路由已被激活!此路由将用户重定向到重定向响应中所示的登录页面。websocket升级请求在某个地方变成了一个普通的http请求!这似乎就是问题所在。是什么导致的呢?

我有同样的问题,但它与清漆设置有关。如果使用清漆,请添加:

sub vcl_recv {
    if (req.http.upgrade ~ "(?i)websocket") {
        return (pipe);
    }
}
sub vcl_pipe {
    if (req.http.upgrade) {
        set bereq.http.upgrade = req.http.upgrade;
        set bereq.http.connection = req.http.connection;
    }
}

查看此链接以供参考:https://varnish-cache.org/docs/4.1/users-guide/vcl-example-websockets.html

相关内容

  • 没有找到相关文章

最新更新