前言
项目上线后,很多时候都不是直接对后端项目进行请求,而且经过了Nginx代理转发请求。
Nginx常规的代理转发配置是不支持websocket协议的。
本节主要介绍如何让Nginx代理支持websocket协议。
一、Nginx官网说明
Nginx对websocket协议的支持:
http://nginx.org/en/docs/http/websocket.html
location /chat/ {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy