
配置文件
proxy_set_header Accept-Encoding ""; sub_filter "a.aa" "c.cc"; sub_filter_last_modified on; sub_filter_types * ; sub_filter_once off; 请求头
Accept image/avif,image/webp,*/* Accept-Encoding gzip, deflate, br Accept-Language zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2 Cache-Control no-cache Connection keep-alive Cookie Host c.cc Pragma no-cache Referer https://c.cc/1.html Sec-Fetch-Dest image Sec-Fetch-Mode no-cors Sec-Fetch-Site same-origin TE trailers User-Agent 响应头
cache-control no-cache content-length 0 content-type text/html; charset= date Sat, 10 Sep 2022 12:43:42 GMT link <https://a.aa/wp-json/>; rel="https://api.w.org/" location https://c.cc/wp-includes/images/w-logo-blue-white-bg.png server nginx strict-transport-security max-age=31536000; includeSubdomains; X-Firefox-Spdy h2 x-redirect-by WordPress 网页源代码的返回内容都是正常的 但响应头里面有个 link 会暴露源站地址
如果请求 https://c.cc/favicon.ico 第一次响应是 302 也会携带这个 link 302 后再次返回状态码 200 的时候内容倒是没问题
1 eason1874 2022-09-10 21:17:00 +08:00 sub_filter 只替换 body 不替换 header ,你得用 njs 或者 ngx_lua 模块去替换 header |
2 muhuan 2022-09-10 21:30:55 +08:00 |
3 mmdsun 2022-09-11 00:21:05 +08:00 之前也遇到替换网页内容 /头的需求,用 nginx + sub_filter 折腾太麻烦了。 随便一个应用网关就能做的的事情 比如 zuul \ spring gateway 修改请求响应非常容易。 |
5 ptyfork 2022-09-11 04:36:08 +08:00 Caddy + replace 插件 |
6 dusu 2022-09-11 12:02:34 +08:00 via iPhone proxy_hide_header |