RFC 9931 warns that bytes sent before an HTTP upgrade is confirmed can be parsed differently by proxies and applications, and recommends waiting for explicit confirmation in most cases.
Last updated
RFC 9931 addresses a security risk in optimistic protocol transitions, where a client sends data before a server confirms an HTTP/1.1 upgrade. The document updates the HTTP/1.1 and UDP-proxying specifications and discusses transitions such as WebSocket and connect-udp.
The risk arises when browsers, proxies, origins or third-party scripts interpret the boundary between the old and new protocols differently. A proxy that forwards bytes too early could cause an upstream service to treat them as a new request, a frame or tunnel data.
The recommended policy is to wait for explicit confirmation before accepting post-transition bytes unless a specification defines a safe optimistic behavior. For future upgrade tokens, RFC 9931 recommends limiting optimistic use to GET requests with no content when the method and body are otherwise irrelevant.
The guidance also calls for tests covering early data, fragmented headers, rejected upgrades, large bodies, HTTP/1.0 clients and third-party-controlled parameters. Proxies should reject conflicting Connection, Upgrade or content-length signals and should not infer success from a route name.
The document frames the protocol transition as a security boundary because it changes which parser handles the bytes. It recommends documenting timeout and connection-close behavior rather than leaving multiple protocol layers to guess about the transition.