The HTTP Upgrade header: when HTTP/1.1 switches protocols
The HTTP Upgrade header proposes switching an HTTP/1.1 connection to a different application protocol. The client proposes it with Connection: Upgrade; a switch occurs only if the server agrees with 101 Switching Protocols. A server can ignore the proposal, so sending Upgrade alone does not change the connection. HTTP/2 and HTTP/3 do not use this header to switch protocols.
The HTTP Upgrade header proposes switching an HTTP/1.1 connection to a different application protocol. The client proposes it with Connection: Upgrade; a switch occurs only if the server agrees with 101 Switching Protocols. A server can ignore the proposal, so sending Upgrade alone does not change the connection. HTTP/2 and HTTP/3 do not use this header to switch protocols.
How does it appear in a request and response?
The client lists protocol tokens in preference order in Upgrade and names Upgrade in Connection so intermediaries know the field is specific to this connection.
GET /realtime HTTP/1.1
Host: example.com
Connection: Upgrade
Upgrade: websocketIf the server can honor the request's semantics under the new protocol and chooses to switch, it sends 101 and identifies the protocol that will be used:
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: websocketAfter 101, both sides exchange data on the same connection using the new protocol's rules. The precise data that follows and how the original request is completed are defined by that protocol. HTTP's 101 signals agreement to change protocols. (RFC 9110 §§7.8, 15.2.2)
Why is Connection: Upgrade required?
Upgrade is a connection-specific field. An HTTP proxy or other intermediary handles connection-specific fields for its own hop and must not blindly forward them to the next hop. The sender therefore uses Connection: Upgrade to mark the field as relevant to this hop. If an upgrade is needed through an intermediary, each hop must support and correctly handle that behavior. A request that sends Upgrade without naming it in Connection is not a valid HTTP/1.1 upgrade proposal. (RFC 9110 §§7.6.1, 7.8)
A server sending 101 cannot switch to a protocol the client did not propose. If it switches multiple protocol layers, it lists them from the lower layer upward. It must not switch if the request cannot be meaningfully honored under the new protocol. (RFC 9110 §7.8)
How do 101 and 426 differ?
101 Switching Protocols means the server accepted a switch on the current connection. 426 Upgrade Required is an error: the server refuses the request using the current protocol but might accept it after a protocol change. A 426 response must identify acceptable protocols in Upgrade; it does not mean the connection has already switched. The client should check the requirement and use a new connection or a supported negotiation process. (RFC 9110 §§15.2.2, 15.5.22)
What about HTTP/2 and HTTP/3?
HTTP/2 does not support upgrading the whole connection to another protocol and forbids connection-specific fields such as Upgrade. HTTP/2 and HTTP/3 use their own connection setup procedures to negotiate the protocol. Adding Connection: Upgrade or Upgrade to an HTTP/2 request does not create a valid switch. An intermediary translating between HTTP/1.1 and HTTP/2 or HTTP/3 must handle or remove connection-specific fields according to each version's rules. (RFC 9113 §§3, 8.2.2; RFC 9114 §3)
WebSocket is a well-known example that uses Upgrade: websocket in an HTTP/1.1 handshake. Browser API behavior, Origin checks, and reconnection design are separate topics; understanding this header alone does not cover them. (RFC 6455 §4.1)
Troubleshooting checklist
When a protocol switch does not happen as expected:
Confirm the connection uses HTTP/1.1. HTTP/2 and HTTP/3 do not switch protocols through `Upgrade`.
Confirm the request contains both `Connection: Upgrade` and the desired protocol token.
Check the response status. If it is not 101, no switch occurred. For 426, check the required protocol and the separate renegotiation process.
Confirm the 101 response's `Upgrade` value is one of the protocols proposed by the client.
Check that each proxy, gateway, and load balancer supports HTTP/1.1 upgrade and relays both sides as the same upgraded session.
References
[RFC 9110: HTTP Semantics §§7.6.1, 7.8, 15.2.2, 15.5.22](https://www.rfc-editor.org/rfc/rfc9110.html)
[RFC 9113: HTTP/2 §§3, 8.2.2](https://www.rfc-editor.org/rfc/rfc9113.html)
[RFC 9114: HTTP/3 §3](https://www.rfc-editor.org/rfc/rfc9114.html)
[RFC 6455: The WebSocket Protocol §4.1](https://www.rfc-editor.org/rfc/rfc6455.html)