Skip to content

HTTP Status Code 426 – Upgrade Required

HTTP Status Code 426 – Upgrade Required

The HTTP 426 Upgrade Required status code is a client error response that indicates the server refuses to perform the requested action using the current protocol. The server sends this status code when it expects the client to switch to a different protocol, typically a more secure or efficient one, as specified in the Upgrade header field in the server’s response.

Examples

Example 1: Upgrading to HTTP/2

In this example, a client makes a request using HTTP/1.1, but the server requires a switch to HTTP/2 for better performance:

HTTP/1.1 426 Upgrade Required
Upgrade: HTTP/2
Connection: Upgrade
Content-Type: text/plain
Content-Length: 53

This server requires the use of the HTTP/2 protocol.

Here, the server responds with a 426 status code along with an Upgrade header specifying “HTTP/2”. The client should initiate a new connection using the HTTP/2 protocol as indicated.

Example 2: Switching to a WebSocket Connection

A client tries to establish a connection using HTTP, but the server requires a WebSocket protocol:

HTTP/1.1 426 Upgrade Required
Upgrade: websocket
Connection: Upgrade
Content-Type: text/plain
Content-Length: 55

This server requires the use of the WebSocket protocol.

In this scenario, the server indicates that the client must switch to the WebSocket protocol by providing the Upgrade: websocket header. The client should then re-initiate the connection using the WebSocket protocol.

Example 3

# Client sends a request example.
GET /example HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 426 426 Upgrade Required
Date: Wed, 09 Oct 2024 23:06:58 GMT
Server: ExampleServer/1.0
Content-Type: application/json

{
    "error": "Description of the error for 426"
}

Example 4: Another use case

# Client sends another example request.
POST /another-example HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 426 426 Upgrade Required
Date: Wed, 09 Oct 2024 23:06:58 GMT
Server: ExampleServer/1.0
Content-Type: application/json

{
    "error": "Detailed message for 426"
}

Summary

The HTTP 426 Upgrade Required status code is used by servers to instruct clients to switch to a different protocol that the server supports and prefers. This is typically used to ensure more secure or efficient communication. The client should check the Upgrade header in the server’s response to determine which protocol to switch to and re-establish the connection accordingly.

 

I am the founder of SEO Leaders and have been involved in the internet and web development in one way or another for over 20 years. Since founding SEO Leaders some 6 years ago I have been heavily involved in web develepment, Digital PR and technical SEO for a wide variety of projects. I hope to enlighten you on a wide range of topics related to my chosen profession!

Back To Top