微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

nginx websocket反向代理configuration

您好,我正在尝试configurationNginx作为websockets的反向代理。 我configuration我的服务器如下:

server { listen 80; server_name www.mydomain.com; access_log off; #error_log off; location / { proxy_pass http://127.0.0.1:8765; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $http_host; proxy_buffering off; } }

但我从客户端收到错误如下

与'ws://www.application.com/ws'的WebSocket连接失败:WebSocket握手期间出错:'连接'标题值不是'升级'

我可能做了一些configuration错误,但我看不到它。

服务器端自动缩小?

如何访问docker定制桥networking中的端口

gunicorn + Nginx:通过套接字或代理服务器?

如何使用django-sslify在我的Django + Nginx + gunicorn web应用上强制使用https,并依靠Cloudflare的新的免费SSL?

将非SNI浏览器redirect到Nginx中仅HTTP的警告页面

客户端的请求标题如下

GET ws://www.talkybee.com/ws HTTP/1.1 Pragma: no-cache Origin: http://www.talkybee.com Host: www.talkybee.com Sec-WebSocket-Key: Ol+O1IDalesHxxWRBt2oqg== User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/27.0.1453.116 Safari/537.36 Upgrade: websocket Sec-WebSocket-Extensions: x-webkit-deflate-frame Cache-Control: no-cache Connection: Upgrade Sec-WebSocket-Version: 13

当我做一个正常的直接连接,我的连接只是工作。 这是工作请求头。

Cache-Control:no-cache Connection:Upgrade Host:www.talkybee.com:8765 Origin:http://www.talkybee.com:8765 Pragma:no-cache Sec-WebSocket-Extensions:x-webkit-deflate-frame Sec-WebSocket-Key:Y026b/84aUkMxVb0MaKE2A== Sec-WebSocket-Version:13 Upgrade:websocket User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/27.0.1453.116 Safari/537.36

PHPMailer:replace认的messageID

Cloudfront正在为源服务器上存在的资产caching来自Nginx404

更改GitLab的端口后,Nginx坏网关

了解Nginx HTTP到HTTPSredirect

Nginx多个服务器模块监听同一端口

这个问题与Nginx版本有关。 请检查Nginx -v,检查您的版本。 1.4版后支持以下参数。

# WebSocket support (Nginx 1.4) proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";

如果您使用的是Ubuntu,您可以使用以下步骤安装更新的版本:

首先删除旧版本( https://askubuntu.com/questions/235347/what-is-the-best-way-to-uninstall-Nginx ):

sudo apt-get remove Nginx sudo apt-get purge Nginx sudo apt-get autoremove

然后安装一个新版本( https://launchpad.net/~Nginx/+archive/development ):

sudo add-apt-repository ppa:Nginx/development sudo apt-get update sudo apt-get install Nginx

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐