Navigation
Introduction
HTTP Status Code 426-Upgrade Required is one of the classes of 4xx(Server Error) response code that indicates the server refuses to process the request using the current protocol but may be willing to do so if the client upgrades to a different protocol.
In order to identify the appropriate protocol(s), the server MUST provide an Upgrade header field in a 426 response.
Example
HTTP/1.1 426 Upgrade Required Upgrade: HTTP/3 Connection: Upgrade To use this service, you must use HTTP version 3. |
Usages
The Upgrade header in the request is often used to switch an HTTP connection to another protocol (such as Websocket), and the server responds with 101 Switching Protocols. This is true when setting up a WebSocket connection and moving from HTTP/1 to HTTP/2 (non-TLS). A server could use the 426 status code to compel this protocol transition, but I’ve never seen any servers do so. This feature may have been implemented to prepare for instances when servers desire to compel a client to use a newer version during the upgrade from HTTP/1.0 to HTTP/1.1, and so this feature may have been beneficial during the transition from HTTP/1.0 to HTTP/1.1. People who are forcing a move from HTTP to HTTPS without an automatic redirect, I believe, utilize this. I’m not aware of any clients that can automatically switch protocols or protocol versions, and I’m also not aware of any browsers that enable this out of the box. My guess is no, but I can’t prove that because I don’t have a source. |
WebSocket
When the WebSocket handshake fails due to an improper protocol version, the server should respond to 426 Upgrade Required (as presented in the Sec-WebSocket-Version HTTP header).
A WebSocket server will often respond with the protocol’s supported version(s):
Sec-WebSocket-Version: 13, 8, 7 |
FAQ
What do you mean by HTTP Status Code 426- Upgrade Required?
HTTP Status Code 426-Upgrade Required is one of the classes of 4xx(Server Error) response code that indicates the server refuses to process the request using the current protocol but may be willing to do so if the client upgrades to a different protocol.
What do you mean by WebSocket?
When the WebSocket handshake fails due to an improper protocol version, the server should respond to 426 Upgrade Required (as presented in the Sec-WebSocket-Version HTTP header).
Status
426 Upgrade Required |
Related Articles
|
HTTP Status Code 204 – No Content |
HTTP Status Code 300-Multiple Choices |
HTTP Status Code 302 Found |
HTTP Status Code 207 Multi-Status |
426 CODE REFERENCES
Rails HTTP Status Symbol | :upgrade_required |
Symfony HTTP Status Constant | Response::HTTP_UPGRADE_REQUIRED |
Conclusion
I hope this article was able to help you with your doubts and queries related to the HTTP status code 426.
Still, if there are any queries related to this topic, feel free to ask in the comment section, we would be happy to assist you. Thank you.
Saurabh Chalise