forked from baskbuddy/zhangshun
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
980 B
18 lines
980 B
# 实时聊天转发片段:合并到现有 HTTPS server 中,不要覆盖整个 Nginx 配置。
|
|
# 部署前核对真实后端地址、端口以及 /api/v1 context-path。
|
|
# 此示例仅用于单后端实例;多实例需要共享消息代理,不能仅添加负载均衡。
|
|
# 前端使用 wss://你的业务域名/api/v1/ws;Token 放在 STOMP CONNECT 头,不放 URL。
|
|
location = /api/v1/ws {
|
|
proxy_pass http://127.0.0.1:8080;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_read_timeout 75s;
|
|
proxy_send_timeout 75s;
|
|
proxy_buffering off;
|
|
}
|
|
# 握手限流目前按直接连接来源计数;经过反向代理时来源可能都是网关。
|
|
# 大规模部署需在网关增加按可信真实 IP 的限流,并核对后端限流配置。
|
|
|