回复至:nginx 反代的sub_filter替换无效

normedia
  • 文章数量: 4
@normedia
楼主
#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

替换无效

来自温州, 浙江, 中国