# Serverless websockets - accepting a path wss://hostname.xxx/\<path\>

**URL:** <https://forum.serverless.com/t/serverless-websockets-accepting-a-path-wss-hostname-xxx-path/13947>\
**Category:** Serverless Framework\
**Tags:** aws, lambda, api-gateway\
**Created:** [February 2, 2021, 10:44pm UTC](https://forum.serverless.com/t/serverless-websockets-accepting-a-path-wss-hostname-xxx-path/13947 "2021-02-02T22:44:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![everters](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/everters/32/5190_2.png) [@everters](https://forum.serverless.com/u/everters)\
**Post date:** [February 2, 2021, 10:44pm UTC](https://forum.serverless.com/t/serverless-websockets-accepting-a-path-wss-hostname-xxx-path/13947/1 "2021-02-02T22:44:06Z")

</div>

Dear Serverless community,

Your work has been a blessing for me. I’m using the framework since 6 months or so, and have deployed various REST APIs on AWS. Great work!

Right now I am facing a pretty big issue, which I have tried to solve for a few hours now.

I have a bunch of websocket clients which would like to contact my endpoint at address of the form wss://hostname.xxx/\<client\_id\>

Unfortunately, it seems that this kind of behavior is not actually supported by api gateway and lambda. This seems pretty odd, as it is pretty common.

I have looked at various documentation, and in particular this medium post [Using parameter mapping in WebSocket API | by Jaewoo Ahn | Medium](https://medium.com/@lancers/using-parameter-mapping-in-websocket-api-67b414376d5e) which seems to offer some workaround, which I am unable to fully grasp for now.

I would like to ask if someone has had this experience before and has found a way to map the path to some field of the event fed to the lambda, or at least to avoid a 403 error every time somebody includes a path in the endpoint address.

Thank you very much for your help

---

<div class="post-metadata">

**Author:** ![everters](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/everters/32/5190_2.png) [@everters](https://forum.serverless.com/u/everters)\
**Post date:** [February 11, 2021, 7:24am UTC](https://forum.serverless.com/t/serverless-websockets-accepting-a-path-wss-hostname-xxx-path/13947/2 "2021-02-11T07:24:12Z")

</div>

It seems that this stackoverflow discussion may provide a solution:

> <https://stackoverflow.com/questions/56116617/aws-api-gateway-custom-url-parameter>

and this Medium article is needed to make it work [Configure Amazon CloudFront CDN for WebSocket connection - Nick Zamosenchuk - Medium](https://nickzamosenchuk.medium.com/configure-amazon-cloudfront-cdn-for-websocket-connection-43c44b3f877c)

---

<div class="post-metadata">

**Author:** ![everters](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/everters/32/5190_2.png) [@everters](https://forum.serverless.com/u/everters)\
**Post date:** [February 19, 2021, 11:01am UTC](https://forum.serverless.com/t/serverless-websockets-accepting-a-path-wss-hostname-xxx-path/13947/3 "2021-02-19T11:01:04Z")

</div>

Those resources were the solution!

It is also possible to use cloudfront to enable insecure websocket connections, and to do a ton of other things. With lambda @ edge is possible to rewrite requests and responses.

Something odd is happening tho. I have a custom domain for my cloudfront distribution, therefore i use a SSL certificate created via ACM for that domain instead of the cloudfront SSL default certificate.

That certificate i got via ACP appears “wrong” though, trying to connect to the endpoint using openssl results in a error.

The default cloudfront certificate has a wrong hostname.

My clients can tolerate a certificate with a wrong hostname but aren’t able to use my custom certificate at all!

Is there something i should be paying attention to in order to allow my own custom certificate to be used?
