#如果上游用giz压缩,需要以下配置,否则subs_filter会失效替换不到
proxy_set_header Accept-Encoding "";
proxy_pass http://192.168.0.3;
#subs_filter字符替换
subs_filter 'jingjia.aaa.cn' 'zt.bbb.cn/jingjia';
#subs_filter正则替换
subs_filter "show\_(.+?)\.html" "$1" gir;
一把情况下,使用替换之后,php和nginx输出的last_modified会被移除,并且以下设置不一定生效sub_filter_last_modified on | off。默认:off,防止缓存。
是否在Response header中写入Last-Modified,控制缓存。
需参考如下,重新编译nginx:如果编译并使用了--with-http_sub_module模块,
还需要注释掉src/http/modules/ngx_http_sub_filter_module.c第159行:
static ngx_int_t
ngx_http_sub_header_filter(ngx_http_request_t *r)
{
……
if (r == r->main) {
ngx_http_clear_content_length(r);
/*ngx_http_clear_last_modified(r);*/
}
……
}
注掉源码,重新编译就可以了
非特殊说明,本博所有文章均为博主原创。
最新文章