Can I use websockets and bearer token together?

Hi guys, I’m running Tyk headless; my API supports Authentication tokens which works fine and adds custom headers based on the client’s metadata to the upstream request. I’m now trying to enable websockets when the client switches protocol to using WS. My upstream server also supports both HTTP and WS protocols. To enable websockets, I’ve added this to my Tyk proxy config:

...
    "http_server_options": {
        "enable_http2": true,
        "enable_websockets": true
    },
...

However, the client is refused connection and I can read the following error in my Tyk logs:

Attempted access with malformed header, no auth header found.

How can I get the websocket to work, with tyk auth tokens?

Hi @Idowu_Ayoola, welcome to the community.

Could you test your API in keyless mode (without authentication) to confirm if it works?

If it does or you had already done that, then could you share your API definition (without the target url or sensitive information). We guess the issue may be with one of the headers.

Additionally, you could enable debug logging for the gateway. Maybe it may show some useful information.