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無法識別和處理
