CloudFront Distribution for subdomain to route websocket connection to ALB

0

Hello,

I have a setup of network load balancer fronting some ec2 instances containing my websocket server. I have created a CloudFront distribution pointing to this NLB. With the intention that clients(IoT devices) from the internet can initiate websocket connections with my server. I have setup the required headers(as defined here) in the "Behavior" part of my CF distribution. And i created a subdomain (e.g. gateway.abc.com), created certificate in ACM and linked it to CF distribution as an alternate domain name. My domain is hosted in bluehost, i have added the CNAME records provided during certificate creation to my DNS server.

My problem is when my IoT devices try to connect via the distribution endpoint (ddgdsgdfg.cloudfront.net), the connections are successful and connecting to my websocket server (i am initiating ws connections NOT wss). However, if i try the same with the alternate domain name i provided, it is not working (gateway.abc.com). What am i missing? ideally i would want to use my subdomain instead of the CF endpoint. I would appreciate any pointers. Also CF logs are not helpful and unfortunately i cannot check the IoT device logs.

  • Could you share the error that the IoT devices throw when trying to establish the ws using your domain? that should shed some light in the issue.

1 個回答
2
已接受的答案

Have you configured the Route 53 alias record with the same name as the Alternate domain name configured in the CloudFront distribution ? You can follow the below documentation for detailed steps [1].

[1] https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-cloudfront-distribution.html

profile pictureAWS
支援工程師
Rutba_Z
已回答 2 個月前
profile picture
專家
已審閱 2 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南