SiteError.comYour friendly guide to HTTP status codes
Status CodesBlog
  1. Home
  2. 4xx Client Error
  3. 428 Precondition Required

428 Precondition Required

🔑
428
Precondition Required
!
?

Example HTTP Response

HTTP Response
HTTP/1.1 428 Precondition Required
Common Causes
  • Missing If-Match or If-Unmodified-Since header
  • Optimistic locking required
  • Concurrent modification protection
Technical Details

What does this mean?

Say the magic words! The server needs conditional headers like If-Match to prevent you from overwriting someone else's changes.

Technical Definition

The origin server requires the request to be conditional to prevent lost updates.

RFC Says

"The 428 (Precondition Required) status code indicates that the origin server requires the request to be conditional. Its typical use is to avoid the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict."

Plain English:

428 means 'You need to include conditional headers (like If-Match) with this request.' It's used to enforce optimistic locking - requiring clients to prove they have the current version before making changes. This prevents the 'lost update' problem where two clients overwrite each other's changes.

Common Misinterpretation

Use 428 before the client sends the update (to tell them they need preconditions), not after. Once they send an update with preconditions that fail, use 412. Think of 428 as 'you must include If-Match' and 412 as 'your If-Match value was wrong'.

View RFC Documentation
Code Snippets

Ready-to-use code for returning this HTTP status in your application:

Node.js
// Express.js
app.get('/example', (req, res) => {
  res.status(428).json({
    error: 'Precondition Required',
    message: 'Your error message here'
  });
});

// Native HTTP
const http = require('http');

http.createServer((req, res) => {
  res.writeHead(428, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({
    error: 'Precondition Required',
    message: 'Your error message here'
  }));
}).listen(3000);

428 Precondition Required FAQ

What causes a 428 Precondition Required error?

Missing If-Match or If-Unmodified-Since header. Optimistic locking required. Concurrent modification protection.

426 Upgrade Required429 Too Many Requests

Popular Status Codes

  • 200 OK
  • 301 Moved Permanently
  • 302 Found
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 500 Internal Server Error
  • 502 Bad Gateway
  • 503 Service Unavailable

Compare Codes

  • 401 vs 403
  • 301 vs 302
  • 404 vs 410
  • 500 vs 502
  • Compare any codes →

Categories

  • Informational
  • Success
  • Redirection
  • Client Error
  • Server Error
  • NGINX
  • Cloudflare
  • AWS ELB
  • Microsoft IIS

Tools

  • Cheat Sheet
  • Status Code Quiz
  • URL Checker
  • API Playground
  • Blog

© 2026 SiteError.com. All rights reserved.