Fix case problem for websocket upgrade

This commit is contained in:
Julien Salleyron 2024-11-06 09:56:04 +01:00 committed by GitHub
parent 7f4ff359a2
commit f70949e3fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 3 deletions

View file

@ -171,7 +171,7 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
if reqUpType != "" {
outReq.Header.Set("Connection", "Upgrade")
outReq.Header.Set("Upgrade", reqUpType)
if reqUpType == "websocket" {
if strings.EqualFold(reqUpType, "websocket") {
cleanWebSocketHeaders(&outReq.Header)
}
}
@ -353,6 +353,7 @@ type fasthttpHeader interface {
SetBytesV(key string, value []byte)
DelBytes(key []byte)
Del(key string)
ConnectionUpgrade() bool
}
// removeConnectionHeaders removes hop-by-hop headers listed in the "Connection" header of h.