428 Precondition Required

HTTP Status CodesClient (4xx)rarerStatus Code: 428Last updated: todayTested on:Google ChromeNode.js v20 LTSJune 2026

The origin server requires the request to be conditional.

428 Precondition Required Quick Fix⏱️ Est. Fix Time: 3 minutes

Usually happens because:

  • Client attempts write operations (PUT/DELETE)

🔍 Quick Checklist:

Meaning

The HTTP 428 Precondition Required client error status code indicates that the origin server requires the request to be conditional (e.g. carrying If-Match or If-None-Match headers). This protects against 'lost update' conflicts.

Root Causes

  • Client attempts write operations (PUT/DELETE) without conditional headers (If-Match) on resources where concurrency locks are enforced.
CauseFrequency
Client attempts write operations (PUT/DELETE)⭐⭐⭐⭐⭐

Common Mistakes

  • Using 412 Precondition Failed when the header is *missing* (use 428 when the header is missing; use 412 when the header is present but evaluates to false).

How to Fix

1Client must fetch the resource ETag using a GET request first.
2Append the ETag value in the If-Match header during writing commands.

Framework-Specific Examples

Express middleware enforcing conditional checks.

Express Example
app.put('/api/data', (req, res, next) => {
  if (!req.headers['if-match']) {
    return res.status(428).json({ error: 'If-Match header required' });
  }
  next();
});

Server Configuration Examples

Nginx forwards conditional headers downstream.

Nginx Config
# Forwarded downstream

Prevention

  • Enforce concurrency checks inside REST documentation pipelines.

Frequently Asked Questions (FAQ)

Q: Why did HTTP introduce the 428 status code?

To prevent the 'lost update' problem, where client A fetches a file, client B fetches it too, B edits and saves, and then A saves, overwriting B's changes silently. Enforcing conditional If-Match headers resolves this.

Q: What is the difference between 428 and 412?

428 Precondition Required means the client *forgot* to send conditional headers. 412 Precondition Failed means the client *sent* headers, but the conditions evaluated to false (e.g. resource was modified by someone else).

Q: Is 428 cacheable?

No. The 428 Precondition Required status code is never cached.

Q: What is the recommended recovery action for clients on 428?

Issue a GET request to obtain the current resource representation and its ETag header, copy the ETag hash, and resend the request with an 'If-Match' header.

Still having this problem?

Didn't solve your problem?

SuggestRequest Error