Closed JulienStitelet closed 5 years ago
You can always extend the default socket.io adapter: https://docs.nestjs.com/websockets/adapter and pass handlePreflightRequest
in there.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I'm submitting a...
Current behavior
using the default @WebSocketGateway() decorator will not help using socket.io + extraHeaders + cors
Expected behavior
I was looking for the optional property of socketIO : handlePreflightRequest for example the possible property into GatewayMetadata interface (see after the extends I had to write)
Minimal reproduction of the problem with instructions
Just try using nestjs, with default @WebSocketGateway(), and access from another url than the nestjs running one. (myself was on angular7 port 4200 where nestjs is in 3001) example frontend code:
What is the motivation / use case for changing the behavior?
I wanted my frontend be able to connect to nestjs websocket host. I had to extend the current
GatewayMetadata
type to addhandlePreflightRequest
middleware likeEnvironment