1

Why does autobahn web socket server change all http header keys to lower case? I need to implement authentication token in header with OAuth2 standard with custom header 'Authorization:Bearer $token'. But it seems from autobahn 'request.headers' in onConnect method of WebSocketServerProtocol class all the keys are changed to lower case. What is the reason behind this? Can I use 'authorization' instead of 'Authorization' as the key to fetch auth token from request in this scenario?

Claudiu
  • 224,032
  • 165
  • 485
  • 680
Bill Goldberg
  • 1,699
  • 5
  • 26
  • 50

1 Answers1

3

According to the HTTP RFC, "HTTP header ... field names are case-insensitive." In your example, any of the following incoming header spellings are equivalent: "Authorization", "authorization", "AuThOrIzAtIoN".

The software in question lower-casifies the header to make lookups easier. You should always use the lower-case version as the key.

Robᵩ
  • 163,533
  • 20
  • 239
  • 308