Score:0

Utilising AWS Cloudfront for domain which listens on non-443 port

fo flag

We have a www.domain.com which resolves to a AWS Load Balancer backed by AWS EC2 Nginx instance.

www.domain.com:8888 proxies to a AWS backend web application.

www.domain.com:443 serves static html from EC2's disk excepting:

  • /app/ path which proxies to a dynamic backend application running on an EC2
  • 404 responses which also proxy to the same dynamic backend EC2 for custom error pages.

Objective: to be able to serve our static html directly from S3 storage under the domain www.domain.com (we currently sync the S3 static files down to the disk of the Nginx server).

Options considered:

  • Cloudfront with a failover origin group will take care of the port 443 traffic nicely. But if we associate www.domain.com with cloudfront, obviously nothing will listen on www.domain.com:8888.

  • If we have a Load Balancer providing the listeners for www.domain.com we can deal with dynamic traffic on ports 443 and 8888. But it's not obvious how to have S3 as a Load Balancer target group. I believe this could be possible with a VPC endpoint for S3. But could this deal with 404 failovers? (Ref: https://aws.amazon.com/blogs/networking-and-content-delivery/hosting-internal-https-static-websites-with-alb-s3-and-privatelink/ )

  • We embark on a project to move www.domain.com:8888 traffic to alt.domain.com:443 and then use option 1. However, as long as we want to preserve links to www.domain.com:8888 I think we are barred from having cloudfront as the destination of www.domain.com.

  • Have a frontend Nginx proxy which proxies 8888 traffic to a Load Balancer, and 443 traffic to cloudfront. This would negate many of the plus points of using Cloudfront by forcing client traffic through a proxy to get there. Plus we'd need to handle SSL termination via Lets Encrypt outside Amazon ACM.

Option 3 seems like the cleanest option, but would not happen quickly or easily.. so we are looking for alternatives.

Are there other options we should be considering?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.