304 Not Modified

Written by Evert Pot - - Aggregated on Tuesday October 9, 2018

304 Not Modified is used in response to a conditional GET or HEAD request. A request can be made condtional with one of the following headers:

If-Modified-Since and If-None-Match are used specifically to allow a client to cache results and asks the server to only send a new representation if it has changed.

If-Modified-Since does this based on a Last-Modified header, and If-None-Match with an ETag.


A client does an initial request:

GET /foo HTTP/1.1
Accept: text/html

A server responds with an ETag:

HTTP/1.1 200 Ok
Content-Type: text/html
ETag: "some-string"

The next time a client makes a request, it can include the ETag:

GET /foo HTTP/1.1
Accept: text/html
If-None-Match: "some-string"

If the resource didn’t change on the server, it can return a 304.

HTTP/1.1 304 Not Modified
ETag: "some-string"


« DHH on a new book, resetting ambition … - Signal vs. Noise

Facebook Code - Facebook releases Safety Check crisis … »