At One Place

HTTP 428 — Precondition Required

HTTP 428
Precondition Required
The server insists the request be conditional, to stop it from silently overwriting someone else's changes.

What 428 actually means

A server that cares about lost updates can require every write to carry an `If-Match` header, so that it can reject the write if the resource changed since the client last read it. A 428 is the server refusing an unconditional write and telling the client to fetch the current ETag and try again. It is the preventive counterpart to 412: 428 stops the dangerous request being made, 412 reports that the safe one lost the race.

Common causes

  • A PUT or PATCH sent without an `If-Match` header to an API that requires one
  • A client that fetched a resource but discarded the ETag
  • An API enforcing optimistic concurrency on all writes

If you're just trying to view the page

  1. Nothing directly — this is a contract between the client software and the API
  2. Reloading and retrying usually resolves it, since the client re-reads the current version

If it's your site

  1. GET the resource, keep its ETag, and send it back as `If-Match` on the write
  2. Serve stable ETags on every resource you require preconditions for
  3. Say which header is missing in the response body; "Precondition Required" alone does not name it

Reference

Status code
428
Reason phrase
Precondition Required
Category
4xx — Client Error
Defined in
RFC 6585 §3

Common questions

What does HTTP 428 mean?
The server insists the request be conditional, to stop it from silently overwriting someone else's changes. A server that cares about lost updates can require every write to carry an `If-Match` header, so that it can reject the write if the resource changed since the client last read it. A 428 is the server refusing an unconditional write and telling the client to fetch the current ETag and try again.
How do I fix a 428 error?
Nothing directly — this is a contract between the client software and the API
Is 428 a client error or a server error?
428 is in the 4xx range, which means client error. The request itself was the problem, so retrying it unchanged will usually return the same code.

Related pages

Sources

  1. Hypertext Transfer Protocol (HTTP) Status Code Registry — IANA
  2. RFC 9110: HTTP Semantics — IETF

How these figures are compiled and checked