August 2017
Intermediate to advanced
278 pages
8h 53m
English
NGINX internally tracks the status of the request ($upstream_cache_status), so by exposing it as a header, we can now see it from the client side. If we use Google DevTools or a utility such as httpstat to see the headers, you should see an output like this:
httpstat http://proxy.nginxcookbook.com/ HTTP/1.1 200 OK Server: nginx/1.11.2 Date: Sun, 09 Oct 2016 12:18:54 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Vary: Accept-Encoding X-Powered-By: PHP/7.0.12 X-Cache-Status: HIT
We can see by the X-Cache-Status header that the request was a hit, meaning it was served from the cache not the backend. Other than the basic hit and miss, there are also a number of other statuses which ...
Read now
Unlock full access