2
我有一個非常特殊的nginx的配置問題:nginx的配置,WebSocket的代理,位置,如果
我需要給nginx的:
- 代理WebSocket連接@/
- 將以index.html爲響應標準的http請求@/
這是最接近我可以得到:
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;
}
我正在對我的應用程序進行結構更改,使用nodejs作爲前端代理,將nginx作爲前端代理。
我必須以這種方式配置nginx,因爲許多程序已經安裝了設備(aka legacy)的預期行爲。
你是個好人,謝謝你。 – 2013-03-06 22:55:10