开启反代的缓存后,把部分接口请求也缓存了,故障查了大半天。
反代开启缓存后的原文配置
location ^~ / {
proxy_pass http://127.0.0.1:8880;
proxy_set_header Host $host;
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;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
add_header X-Cache $upstream_cache_status;
proxy_ssl_server_name off;
proxy_ssl_name $proxy_host;
if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" ) {
expires 1m;
}
proxy_ignore_headers Set-Cookie Cache-Control expires;
proxy_cache proxy_cache_panel;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 304 301 302 10m;
}
这是缓存命中标识,一开启缓存就出问题。
其实本意只是想对部分资源开启cache-control即可,但是没想到配置了所有资源的proxy_cache