如何为所有链接保留nginx proxy_pass的URL

如何为所有链接保留nginx proxy_pass的URL,nginx,url-rewriting,proxypass,Nginx,Url Rewriting,Proxypass,我有两个领域: abc.com def.net 问题: 我想让网站abc.com/example(带有该子路径)加载站点def.net并作为abc.com/example/*URI导航。我认为可以使用nginx proxy_pass位置规则来完成,但是当通过abc.com/example加载站点时,如果我单击一个链接,那么它将重定向到def.net/*域URI 我当前的配置: location /example { proxy_pass https://def.net/; # with

我有两个领域:

  • abc.com
  • def.net
  • 问题: 我想让网站abc.com/example(带有该子路径)加载站点def.net并作为abc.com/example/*URI导航。我认为可以使用nginx proxy_pass位置规则来完成,但是当通过abc.com/example加载站点时,如果我单击一个链接,那么它将重定向到def.net/*域URI

    我当前的配置:

    location /example {
        proxy_pass https://def.net/; # with slash
    }
    

    我需要像iframes这样的东西来做。我正在阅读nginx文档,我认为这是可能的,但我还不确定如何实现。可能正在使用重写规则。

    如何在URI前缀下使用nginx代理某些内容”问题再次出现。阅读答案,了解可能的方法。