Determine WebSocket connection without Upgrade header

The HTTP Upgrade header is hop-by-hop only and therefore removed by a reverse proxy.
Read more: http://nginx.org/en/docs/http/websocket.html
This commit is contained in:
Sebastian Serth
2023-05-10 00:26:27 +02:00
parent 259e7de4a9
commit f6278b27cf

View File

@ -15,8 +15,7 @@ module Middleware
private
def websocket_upgrade?(request)
request.get_header('HTTP_CONNECTION')&.casecmp?('Upgrade') &&
request.get_header('HTTP_UPGRADE')&.casecmp?('websocket')
request.has_header?('HTTP_SEC_WEBSOCKET_VERSION')
end
def extract_sentry_parameters(request)