428 Precondition Required

To avoid multiple users writing to the same resources and overwriting each others changes, its useful to take advantage of conditional requests, using the If-Match, If-None-Match, If-Modified-Since and If-Unmodified-Since headers.

These headers are opt-in though. If a server wants to force a client to use them, a server can return 428 Precondition Required. Forcing clients to use Etags and precondition means there’s a lower chance of clients overwriting changes, because they are forced to to consider the current state of the service before changing something.

412 Precondition Failed is a bit different, as that status code is only used when a client did submit precondition headers, but the headers didn’t match the current state of the resource.


PUT /foo.txt HTTP/1.1
Content-Type: text/plain

Hello world
HTTP/1.1 428 Precondition Required
Content-Type text/plain

Please try submitting this request again with a If-Match header


HTTP series

This article is part of an ongoing series about the HTTP protocol.

If you want to follow along as I write them, you can Subscribe to my Atom feed or Mailing list.

Informational 1xx

Successful 2xx

Redirection 3xx

Client Error 4xx

Web mentions