Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
AWS cloudfront route root to EC2 route anything else to S3

We have an angular app living in S3 we would like our domain to serve when there is anything after the / but a flat html page and basic assets to be served from an EC2 when the root of the domain is accessed.

So far we have not gotten anything to work and we're really hoping we can make something work.

So far in cloudfront we have try to make the default route to an EC2 origin and /* and event / route to an S3 origin but nothing seems to be working.

How can we get our domatin example.com serve our EC2 files but anything other than the root, ie. example.com/one, example.com/two, etc. route to the S3 single page app

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

So far in cloudfront we have try to make the default route to an EC2 origin and /* and event / route to an S3 origin but nothing seems to be working.

If I understand what you're trying to do, that's sort of backwards. * matches everything, including nothing, and including more slashes.

Create a new cache behavior matching the path / and pointing to EC2 origin. This catches the main page.

Create a new cache behavior matching the path /*/* pointing to the EC2 origin. This catches anything in a folder, e.g. /pics/cats.jpg and /pics/cats/funny.jpg and /pics/cats/hilarious/lol.jpg.

If there are any files (other than the main page) in the root of the web server in EC2, create a new cache behavior matching the path /*.* pointing to the EC2 origin. This catches files in the root directory, e.g. /cat.jpg.

Point the default cache behavior to S3. Everything already matched by the two or three other behaviors goes to EC2, and what's left over goes to the bucket, which would be / followed by any characters excluding another / or ., which would have been captured by one of the behaviors routing to EC2.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!