Agent Wranglers

Performance Recommended

Answer repeat requests with 304

Send an ETag or Last-Modified on responses, and answer matching requests with 304 Not Modified.

How to do it

Make the ETag from a hash of the content. Compare it with If-None-Match, and answer 304 with the same caching headers.

Example

GET /about HTTP/1.1
Host: example.com
If-None-Match: "a1b2c3"

HTTP/1.1 304 Not Modified
ETag: "a1b2c3"
Cache-Control: public, max-age=300

How to check

curl -sI -H 'If-None-Match: <etag>' returns 304.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/performance/conditional-requests.