Skip to content

426 Upgrade Required

The server refuses to handle the request over the current protocol, and its Upgrade header names the protocol to switch to.

What 426 Upgrade Required means

The server must send an Upgrade header listing the protocol it requires. If the client then asks to upgrade and the server agrees, the switch happens with 101 Switching Protocols.

A common case is a WebSocket endpoint receiving a plain HTTP request without the upgrade handshake.

Common causes

  • A WebSocket endpoint opened as a normal web page or called with a plain HTTP client.
  • A reverse proxy dropping the Upgrade and Connection headers before they reach the app.
  • A server that requires a newer protocol than the client used.

How to fix 426 Upgrade Required

  1. Connect with a WebSocket client using ws:// or wss://, or with whatever protocol the Upgrade header names.
  2. In nginx, set proxy_http_version 1.1, proxy_set_header Upgrade $http_upgrade and proxy_set_header Connection "upgrade".
  3. Update the client or library if it does not support the required protocol.

Headers that go with it

  • Upgrade
  • Connection

Example response

HTTP/1.1 426 Upgrade Required
Upgrade: HTTP/2.0
Content-Type: text/plain; charset=utf-8

426 Upgrade Required

How to check for a 426 response

cURL

# Print only the status code
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/

JavaScript (Node.js)

const res = await fetch("https://example.com/");
if (res.status === 426) {
  console.log(res.status, res.statusText);
}

Python

import requests

res = requests.get("https://example.com/")
if res.status_code == 426:
    print(res.status_code, res.reason)

Go

res, err := http.Get("https://example.com/")
if err != nil {
	log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode == 426 {
	fmt.Println(res.Status)
}

Specification

426 Upgrade Required is defined in RFC 9110, section 15.5.22.

  • 101

    Switching Protocols

    The server agrees to switch to the different protocol the client asked for in its Upgrade header, such as WebSocket.

  • 505

    HTTP Version Not Supported

    The server does not support, or refuses to use, the major HTTP version the client used for the request.

  • 400

    Bad Request

    The server could not understand the request because something in it is malformed, like broken JSON, bad syntax or invalid headers.

← all 63 HTTP status codes

Type to search posts, tools and projects.

Keyboard shortcuts

Search+Kor/
Go to homegthenh
Go to bloggthenb
Go to projectsgthenp
Go to timelinegthent
Show this help?
Close search or helpesc