遇到一个奇葩问题。
反代http://a.com/ 反代了 http://b.com/ ,我用了subs_filter替换其中的一个字符串。
但实际效果是没有替换成功。
这是我的配置:
location / {
proxy_pass http://b.com;
proxy_cookie_domain b.com a.com;
proxy_buffering off;
proxy_http_version 1.1;
proxy_ignore_headers Expires Vary Cache-Control X-Accel-Expires ;
proxy_set_header Accept-Encoding "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header User-Agent $http_user_agent;
proxy_set_header If-Modified-Since "";
subs_filter xxxxxx yyyyyy;
}
我怀疑是缓存的问题,于是请求的时候请求了http://a.com/?a ,于是就好了。
就是 http://a.com/ 的时候有问题。
我用chrome的隐身模式访问的,应该不是本地缓存的问题。
于是我把nginx的debug日志打开,得到的是这样一个warn:
2015/05/27 23:01:47 [warn] 15942#0: *32 http subs filter header ignored, this may be a compressed response. while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: a.com, request: "GET / HTTP/1.1", upstream: "http://yyy.yyy.yyy.yyy:80/", host: "a.com"
日志意思是不是返回的包是gzip压缩过的,所以替换不了。但实际上我设置了Accept-Encoding:"",而且请求/?a的时候却是好的。所以我排除了compressed的原因。
求问各位v友有没有遇到过的