location /www.xxx.com {
proxy_pass http://www.xxx.com/;
proxy_hide_header "X-Frame-Options";
proxy_set_header Accept-Encoding "";
sub_filter <head> '<head><base href="http://www.xxx.com/" />';
}
上面是nginx的配置
proxy_hide_header "X-Frame-Options";
去掉response中的X-Frame-Options,让页面可以让Iframe加载
sub_filter <head> '<head><base href="http://www.xxx.com/" />';
将页面中的"<head>"字符串替换成<head><base href="http://www.xxx.com/" />,
作用是让该页面以引入的xxx.com的资源别再发给nginx了,直接去http://www.xxx.com/去获取
proxy_set_header Accept-Encoding "";
让www.xxx.com那边别以gzip的方式给nginx传页面,该句为sub_filter 服务,gzip压缩的页面sub_filter无法识别和处理