NGINX proxy_pass 不更改 URL

NGINX proxy_pass 不更改 URL

我的目標

我的目標是重定向到不同的網頁而不更改地址欄中的 URL。例如,我想從https://my.site.com/pathto重定向https://external.com/other,但只有頁面內容應該更改,而不是 URL。

目前配置

這是我嘗試過的。我想,這proxy_redirect可能是個好主意,所以我基於以下配置NGINX 文檔。但是,雖然這確實加載了 的內容https://external.com/other,但地址列中的 URL 更改為https://my.site.com/other。域名保持不變,但路徑發生變化。

location = /path {
    proxy_pass https://external.com/other;
    proxy_redirect default;
}

相關內容