nginx配置支持websocket协议wss

其实wss与https,并没有太大的差别,只是需要升级下协议。

在原来的配制下增加下面即可:

proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  • Connection: Upgrade:表示要升级协议
  • Upgrade: websocket:表示要升级到websocket协议。
posted @ 2024-07-03 09:48  jiduoduo  阅读(3)  评论(0编辑  收藏  举报