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

normedia
  • 文章数量: 4
@normedia
楼主
#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段还是无效啊

来自温州, 浙江, 中国