Controller mappings returns 200 when request is websocket request

Enonic version: 6.11.1
OS: macOS

Client-side request var ws = new WebSocket('/path/to/mapped/controller')

Server side response with controller mapping
exports.get = function(req) { if (!req.webSocket) return { status: 404 }; // If it is not a web socket request return someValidWebsocketResponseObject; }

Expected response code to client: 101 (change protocol)
Actual response code to client: 200 (OK)

Moving the code to be served as a service without controller mapping

Client-side request var ws = new WebSocket('/path/to/_/service')
With the same server side response

Expected response code to client: 101 (change protocol)
Actual response code to client: 101 (change protocol)

That sounds like a bug - maybe we can fix it before the release of 6.12 @ase?

We are verifiying it today. If it’s confirmed then we’ll try to squeeze the fix in 6.12, yes.

1 Like

We have fixed the bug, it will be included in 6.12.

3 Likes