标签: Nginx
正在查看 3 条回复
-
作者帖子
-
-
2021年9月19日 下午9:31 #21672
123.com反代abc.com
abc.com/123.json 可以替换成功
abc.com/456.abc.js 替换无效需求是要解决456.abc.js的替换问题proxy_set_header Accept-Encoding “”;
sub_filter_types *;
sub_filter_once off;
这些都写了
求解决这个问题,付费求助,加616+764+47=Q
-
2021年9月19日 下午9:32 #21673
把你完整的nginx配置文件贴上来。论坛编辑器有贴代码功能
-
2021年9月19日 下午9:41 #21674
#PROXY-START/ location ~* .(gif|png|jpg|css|js|woff|woff2)$ { proxy_pass https://cmsstaticv2.ffquan.cn; proxy_set_header Host cmsstaticv2.ffquan.cn; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; expires 12h; } location / { proxy_pass https://cmsstaticv2.ffquan.cn; proxy_set_header Host cmsstaticv2.ffquan.cn; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; add_header X-Cache $upstream_cache_status; #Set Nginx Cache sub_filter_types *; proxy_set_header Accept-Encoding ""; sub_filter "ffquan" "xiaoke"; sub_filter_once off; add_header Cache-Control no-cache; } #PROXY-END/
https://fandai1.xiaoke.name/asset-manifest.json
可以替换成功
https://fandai1.xiaoke.name/js/app.591f9646.js
替换无效
-
2021年9月19日 下午9:51 #21675
location 匹配的原则是从长到短,所以你上面的配置文件中 app.591f9646.js 匹配到的是以下块:
location ~* .(gif|png|jpg|css|js|woff|woff2)$ { proxy_pass https://cmsstaticv2.ffquan.cn; proxy_set_header Host cmsstaticv2.ffquan.cn; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; expires 12h; }
想对关键字替换的话就把替换相关的配置提升到全局作用域上
-
2021年9月19日 下午9:57 #21676
#PROXY-START/ location / { proxy_pass https://cmsstaticv2.ffquan.cn; proxy_set_header Host cmsstaticv2.ffquan.cn; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; add_header X-Cache $upstream_cache_status; #Set Nginx Cache sub_filter_types *; proxy_set_header Accept-Encoding ""; sub_filter "ffquan" "xiaoke"; sub_filter_once off; add_header Cache-Control no-cache; } #PROXY-END/
#PROXY-START/ location ~* .(gif|png|jpg|css|js|woff|woff2)$ { proxy_pass https://cmsstaticv2.ffquan.cn; proxy_set_header Host cmsstaticv2.ffquan.cn; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; expires 12h; sub_filter_types *; proxy_set_header Accept-Encoding ""; sub_filter "ffquan" "xiaoke"; sub_filter_once off; } location / { proxy_pass https://cmsstaticv2.ffquan.cn; proxy_set_header Host cmsstaticv2.ffquan.cn; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; add_header X-Cache $upstream_cache_status; #Set Nginx Cache sub_filter_types *; proxy_set_header Accept-Encoding ""; sub_filter "ffquan" "xiaoke"; sub_filter_once off; add_header Cache-Control no-cache; } #PROXY-END/
改成这2段还是无效啊
-
2021年9月19日 下午10:04 #21677
我测试看已经生效了。你 ctrl+f5 刷新看看,或者在 url 后面追加个随机参数
-
2021年9月19日 下午10:11 #21678
缓存这个坑,刚都换浏览器测试了……
-
-
-
-
作者帖子
正在查看 3 条回复
- 哎呀,回复话题必需登录。