Fix case-sensitive header Sec-Websocket-Version

This commit is contained in:
Thomas Brandstetter 2020-04-21 17:16:05 +02:00 committed by GitHub
parent fe5a4a26f8
commit 756aa82aa9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,12 +62,15 @@ func buildProxy(passHostHeader *bool, responseForwarding *dynamic.ResponseForwar
}
// Even if the websocket RFC says that headers should be case-insensitive,
// some servers need Sec-WebSocket-Key and Sec-WebSocket-Protocol to be case-sensitive.
// some servers need Sec-WebSocket-Key, Sec-WebSocket-Protocol and Sec-WebSocket-Version
// to be case-sensitive.
// https://tools.ietf.org/html/rfc6455#page-20
outReq.Header["Sec-WebSocket-Key"] = outReq.Header["Sec-Websocket-Key"]
outReq.Header["Sec-WebSocket-Protocol"] = outReq.Header["Sec-Websocket-Protocol"]
outReq.Header["Sec-WebSocket-Version"] = outReq.Header["Sec-Websocket-Version"]
delete(outReq.Header, "Sec-Websocket-Key")
delete(outReq.Header, "Sec-Websocket-Protocol")
delete(outReq.Header, "Sec-Websocket-Version")
},
Transport: defaultRoundTripper,
FlushInterval: time.Duration(flushInterval),