Skip to content

426 Upgrade Required — Meaning, Common Causes & How to Fix

426 4xx Client Error RFC 9110 §15.5.22

426 Upgrade Required means: The server refuses to perform the request using the current protocol and requires an upgrade, specified in the Upgrade header (e.g. TLS/1.2 or HTTP/2). The client should switch protocols and retry. Client-error 4xx codes mean the request itself is the problem: malformed syntax, missing credentials, forbidden access, a nonexistent resource or a violated precondition. The server is telling the client what to change; retrying the identical request without a fix will reproduce the same error. In practice you will meet 426 when an endpoint requires https and answers plain http with 426; a service mandates http/2 or http/3 for api access; a websocket-only endpoint rejects plain http requests. On the client side, read the Upgrade header, switch to the required protocol (usually: use https://), and retry. On the server side, prefer 301 to HTTPS for browsers; use 426 for protocol requirements where a redirect is not meaningful (e.g. h2c-only APIs).

Advertisement
Ad slot · ref-top

When 426 happens

  • An endpoint requires HTTPS and answers plain HTTP with 426
  • A service mandates HTTP/2 or HTTP/3 for API access
  • A WebSocket-only endpoint rejects plain HTTP requests

How to fix it

On the client

Read the Upgrade header, switch to the required protocol (usually: use https://), and retry.

On the server

Prefer 301 to HTTPS for browsers; use 426 for protocol requirements where a redirect is not meaningful (e.g. h2c-only APIs).

Should you retry?

Not retryable as-is: change the request (credentials, payload, URL) first.

Debugging steps

When 426 appears unexpectedly, start by capturing the full exchange: 'curl -i' or the browser DevTools Network tab shows the exact status line and response headers, which often carry the real explanation. Read the error body first — well-designed APIs name the offending field or missing credential. Then diff your actual request, headers included, against the documented contract. For this code specifically, check whether the most common trigger applies to your situation: an endpoint requires https and answers plain http with 426. Compare your exchange against the raw HTTP example above. If you operate the server, correlate the timestamp with application and proxy logs using the request id; if you are the client, verify the request shape against the API documentation before changing anything or retrying.

Notes & gotchas

For browsers, a 301 to https:// is the friendlier upgrade path; 426 with an Upgrade header is the protocol-level signal aimed at API clients and non-browser agents.

Examples

Raw HTTP
HTTP/1.1 426 Upgrade Required
Upgrade: TLS/1.2, HTTP/2.0
Connection: Upgrade
Content-Type: application/json
Content-Length: 108

{
  "error": "upgrade_required",
  "message": "An endpoint requires HTTPS and answers plain HTTP with 426"
}
curl
curl -i https://api.example.com/v1/resource   # observe the 426 response and its headers
JavaScript (fetch)
const res = await fetch("https://api.example.com/v1/resource");
if (res.status === 426) {
  const problem = await res.json(); // read field-level details
  // fix the request (credentials, payload, URL) — identical retries keep failing
  throw new RequestError(problem);
}
Python (requests)
import requests

res = requests.get("https://api.example.com/v1/resource", timeout=10)
if res.status_code == 426:
    problem = res.json()  # field-level error details
    # correct the request before retrying — identical retries keep failing
    raise RequestProblem(problem)

Frequently asked questions

426 vs 301 for HTTP-to-HTTPS?

Browsers follow 301 to https:// naturally; 426 with Upgrade: TLS/1.2 is the protocol-level signal, mostly seen in non-browser API contexts.

Does 426 mean my HTTP version is too old?

It can — the Upgrade header names what the server wants, whether that is TLS, HTTP/2, or another protocol entirely.

Are 4xx errors always the client's fault?

By contract yes — the server asserts the request must change. In practice servers sometimes misuse 4xx for their own problems (e.g. 400 for internal validation bugs), so read the error body before blaming your client code.

Should I retry 4xx responses automatically?

Generally no: the server says the request must change. Exceptions are 408 (fresh connection), 425 (after handshake) and 429 (after Retry-After). Blind retries of 400/401/403/404 just burn quota.

Advertisement
Ad slot · ref-in-article

Try the JSON Validator

Check JSON syntax and locate errors by line and column.

Open tool →