diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index b7fd2348732..03f4db14b9f 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 use `axum::serve(listener, service)` or hyper/hyper-util for more configuration options ([#1868]) - **breaking:** Only inherit fallbacks for routers nested with `Router::nest`. Routers nested with `Router::nest_service` will no longer inherit fallbacks ([#1956]) +- **fixed:** Don't remove the `Sec-WebSocket-Key` header in `WebSocketUpgrade` [#1664]: https://github.com/tokio-rs/axum/pull/1664 [#1751]: https://github.com/tokio-rs/axum/pull/1751 diff --git a/axum/src/extract/ws.rs b/axum/src/extract/ws.rs index 991ee0b8bb9..7d3e235f1e0 100644 --- a/axum/src/extract/ws.rs +++ b/axum/src/extract/ws.rs @@ -381,8 +381,9 @@ where let sec_websocket_key = parts .headers - .remove(header::SEC_WEBSOCKET_KEY) - .ok_or(WebSocketKeyHeaderMissing)?; + .get(header::SEC_WEBSOCKET_KEY) + .ok_or(WebSocketKeyHeaderMissing)? + .clone(); let on_upgrade = parts .extensions