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 réponse
2
Réponse acceptée

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
INGÉNIEUR EN ASSISTANCE TECHNIQUE
Rutba_Z
répondu il y a 2 mois
profile picture
EXPERT
vérifié il y a 2 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions