Apache 2 反向代理,使用 http 硬編碼的內部應用程式

Apache 2 反向代理,使用 http 硬編碼的內部應用程式

我已經設定了啟用 https 的 Apache 反向代理,Apache (https) -> 內部應用程式 (http)

然而,一些資源如 javascript 仍然是 http 形式,可能使用 http 進行硬編碼,因此它們會被瀏覽器阻止(strict-origin-when-cross-origin)。

如何將回應從內部應用程式重寫或重新導向到 https

http://subdomain.myserver.com/js/somefile.js 至https://subdomain.myserver.com/js/somefile.js ,到達瀏覽器之前

這是我的配置

<VirtualHost *:80>
    ServerName subdomain.myserver.com   
    RewriteEngine On
    RedirectPermanent / https://subdomain.myserver.com/
</VirtualHost>

<VirtualHost *:443>
    ServerName subdomain.myserver.com
    Header edit Location ^http: https:
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:8090/
    ProxyPassReverse / http://127.0.0.1:8090/
</VirtualHost>

謝謝。

相關內容