HTTPfy

428 Precondition Required

The server requires the request to be conditional (If-Match etc.) to prevent lost updates.

428 at a glance

Code
428
Name
Precondition Required
Class
4xx Client error
Status
IANA-registered standard code
Defined in
RFC 6585, Section 3
Cacheable by default
No by default. Caches store it only when the response carries explicit freshness (Cache-Control max-age, s-maxage or Expires).

What 428 means

428 Precondition Required (RFC 6585) is returned when a client tries to modify a resource without sending a precondition such as If-Match. The server forces clients to prove they have seen the latest version, so two clients editing at once cannot silently overwrite each other.

What typically causes a 428

  • APIs that enforce optimistic concurrency, e.g. some REST APIs for configuration or documents.
  • Firmware and device-management APIs protecting shared state.

Fix it on the server

  • Explain in the body which header is required, and return ETags on GET so clients can supply them.

Fix it as a client or visitor

  • GET the resource, read its ETag, and resend the update with If-Match: "<etag>".

Headers that go with 428

HeaderRole
If-MatchThe precondition the client must send.
ETagValue to use in If-Match.

Example response

HTTP/1.1 428 Precondition Required
Content-Type: application/json

{"error": "Send If-Match with the current ETag"}

Opens the HTTP headers tool with your URL filled in; it shows the status line and headers of every redirect hop.