Nginx掩盖其他域到我的域名

是否有可能掩盖一些其他域名到我的域名内的HTML与Nginx,例如:

<iframe src="https://example.com/embed/abcd" frameborder="0" width="640" height="450" scrolling="no"></iframe> 

那么我想这样向我的用户展示

 <iframe src="http://example2.com/embed/abcd" frameborder="0" width="640" height="450" scrolling="no"></iframe> 

这可能与nginx有关吗?

我曾尝试通过使用nginx rewriteproxy_pass但似乎不起作用。

使用Nginx的ngx_http_sub_module模块非常简单。

 sub_filter_types text/html; # optional sub_filter '//example.com' '//example2.com'; 

如果出于性能方面的考虑,最好将这些语句放在location块中。

您可能还需要使用proxy_cookie_domain和proxy_redirect指令重写响应头,以消除旧域的更多痕迹。