Skip to content

Commit

Permalink
make header values for WebSocket upgrade case insensitive (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbanikazemi authored Jan 5, 2022
1 parent a701de8 commit 1a7f4ae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,15 @@ func isWebSocketUpgrade(header http.Header) (bool, error) {
if header.Get("Sec-Websocket-Protocol") != grpcwebsocket.SubprotocolName {
return false, nil
}
if header.Get("Connection") != "Upgrade" {

if !strings.EqualFold(header.Get("Connection"), "upgrade") {
return false, errors.New("missing 'Connection: Upgrade' header in gRPC-websocket request (this usually means your proxy or load balancer does not support websockets)")
}
if header.Get("Upgrade") != "websocket" {

if !strings.EqualFold(header.Get("Upgrade"), "websocket") {
return false, errors.New("missing 'Upgrade: websocket' header in gRPC-websocket request (this usually means your proxy or load balancer does not support websockets)")
}

return true, nil
}

Expand Down

0 comments on commit 1a7f4ae

Please sign in to comment.