Nginx:如果从缓存中提取,请验证 nginx

Qui*_*Par 3 nginx

我使用 nginx 缓存来缓存 html 和资产。如何验证 nginx 是否真正缓存资产并从缓存中传送?

kol*_*ack 7

您可以像这样添加标题:

add_header X-Cache-Status $upstream_cache_status
Run Code Online (Sandbox Code Playgroud)

http://wiki.nginx.org/HttpUpstreamModule#.24upstream_cache_status