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 Answer
2
Accepted Answer

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
SUPPORT ENGINEER
Rutba_Z
answered 3 months ago
profile picture
EXPERT
reviewed 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions