LoginSignup
2
3

More than 5 years have passed since last update.

[nginx] リバースプロキシキャッシュから返ってきてるか確認する方法

Posted at

server ディレクティブに以下を追加

nginx.conf
add_header X-Cache-Status $upstream_cache_status;

キャッシュヒットしてる時は X-Cache-Status ヘッダとして HIT、キャッシュヒットしてない時は MISS が返ってくる

$ wget -S --spider https://lets.ninja/
Spider mode enabled. Check if remote file exists.
--2016-06-20 20:02:13--  https://lets.ninja/
Resolving lets.ninja... 54.92.34.103
Connecting to lets.ninja|54.92.34.103|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Server: nginx
  Date: Mon, 20 Jun 2016 11:02:13 GMT
  Content-Type: text/html; charset=UTF-8
  Connection: keep-alive
  Vary: Accept-Encoding
  X-Cached: Mon, 20 Jun 2016 08:40:33 GMT
  X-Cache-Status: HIT
Length: unspecified [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3