How can we improve the Microsoft Edge developer experience?

Websocket - support for custom headers for handshake

please consider adding ability to add custom headers for handshake. In RFC6455 there one interesting point:

The request MAY include any other header fields, for example, cookies [RFC6265] and/or authentication-related header fields such as the |Authorization| header field [RFC2616], which are processed according to documents that define them. I've found an example how to add custom header to handshake: https://blog.heckel.xyz/2014/10/30/http-basic-auth-for-websocket-connections-with-undertow/ but this is for Java and unfortunately isn't possible in HTML5.

When searching over the net I found many places question about this option, for example: sta/websocket-sharp#22 https://stackoverflow.com/questions/4361173/http-headers-in-websockets-client-api/4361358#4361358 aspnet/SignalR#888

For example in Python this is possible https://stackoverflow.com/questions/15381414/sending-custom-headers-in-websocket-handshake. Other languages also support this. Last place missing is the browser.

Currently setting custom headers isn't supported in any browser, as it isn't part of any standard (it is part of RFC 6455 but not part of WHATWG). I've filled feature request in WHATWG (https://github.com/whatwg/html/issues/3062) but I was asked to create feature requests for each main browser. Having Your interest this feature could be added to standard.

16 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Misiu shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base