
我無法使用 cname,因此我想將我的服務拆分到子目錄中。
location /ha/
{
proxy_pass http://localhost:58123/; #local IP of my HA server
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
當我這樣做時,我得到了 HA 徽標,但在開發人員控制台中我看到他嘗試從主側加載文件。
例如/ha/frontend_latest/app.83207343.js
我得到/frontend_latest/app.83207343.js
答案1
是的,因為您的/ha/
頁面列為/frontend_latest/app.83207343.js
資源。您可以透過三種方法來解決這個問題:
- 告訴您的應用程式它應該使用相對路徑,例如
frontend_latest/app.83207343.js
- 告訴您的應用程式它應該使用絕對但正確的路徑,例如
/ha/frontend_latest/app.83207343.js
. - 使用類似的東西ngx_http_sub即時重寫。