Search code examples
amazon-web-serviceswebsocketaws-api-gateway

can I proxy AWS API Gateway WebSocket to WebSocket?


Currently I am using the API Gateway as a kind of proxy to provide https simply

https://random-aws-name.com => http://my-domain.com

The route was $default

The integration setup is HTTP ANY -> http://my-domain.com

I am now having to setup an Websocket server on my domain that is already listening at ws://my-domain.com. I can connect directly to this socket but not using the AWS API Gateway

wss://random-aws-name.com => ws://my-domain.com

Currently I an getting unexpected error 400, using wscat

I tried to enable API gateway logging and do not see any log arrive


Solution

  • IMHO, AWS API Gateway is only able to provide a wss end point and route requests to HTTP backends only. If we already have a backend websocket server, I don't see an option in AWS API Gateway to perform such routing (Although I would be glad to be proven wrong as I have such a requirement myself.).

    I actually tried giving wss:// url as the Endpoint URL but I got an error while deploying the API saying Invalid HTTP endpoint specified for URI