Rod*_*ist 2 config nginx websocket
我有一个非常具体的nginx配置问题:
我需要nginx:
这是我能得到的最接近的:
location = / {
if ($http_upgrade != "websocket") {
# Here lies my problem:
# This returns a http: 302 where i just need it to return the contents
# of index.html
return https://admin.permaconn.com/index.html;
}
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://localhost:8080;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用我的应用程序进行结构更改,使用nodejs作为前端代理,将nginx用作前端代理.
我必须以这种方式配置nginx,因为许多程序已经安装了设备(也就是遗留设备)的预期行为.
VBa*_*art 11
你滥用return指令.
location = / {
index index.html;
if ($http_upgrade = "websocket") {
proxy_pass http://localhost:8080;
}
proxy_http_version 1.1;
proxy_set_header Upgrade websocket;
proxy_set_header Connection upgrade;
}
Run Code Online (Sandbox Code Playgroud)
文档:
| 归档时间: |
|
| 查看次数: |
2657 次 |
| 最近记录: |