AWS API Gateway WebSocket Error: Unexpected response: HTTP/1.1 101 Switching Protocols

430 Views Asked by At

I have implemented Socket.io in the backend with netty SocketIO in java spring boot. And client connects to WebSocket using ws://{server.ip.address}:5291/socket/?transport=websocket http://{server.ip.address}:5291/socket/?transport=websocket

These both work as expected. Now I have configured WebSocket on API gateway with HTTP integration.

WebSocket Connet

And trying to connect using a gateway URL wss://{app-id}.execute-api.{region}.amazonaws.com/{stage}/?transport=websocket

But it gives error: Execution failed due to configuration error: Unexpected response: HTTP/1.1 101 Switching Protocols

I have tried to diable proxy and enable Add Integration reponse option-> on Integration reposne add the response key '/101/' but nothing woked.

Also Route Response seems disabled.

Can Anyone tell me how to overcome from this issue and where I have to set respose code 101?

Do I need to change anyhting in Backend code for API gateway?

0

There are 0 best solutions below