0

I have a Cloudfront distribution and two origin domains that are not hosted in AWS.

I want to failover to the second domain if a file is not found in the first domain.

I've created two behaviours, but if the file is 404 in the first behaviour Cloudfront does not continue to check further behaviours.

What I want to happen is if the first behaviour is 404 then Cloudfront tries the next behaviour.

How could I make this work?

Andy
  • 317
  • 2
  • 5
  • 16
  • Do you want to *fail over* to origin 2 until origin 1 becomes healthy again... or do you want to serve content from two places, depending on whether one has the file or the other? – Michael - sqlbot Sep 19 '18 at 20:23
  • @Michael-sqlbot Thanks for helping, I'd like to serve content from two places depending on whether one has the file or the other – Andy Sep 20 '18 at 07:53
  • Doing that automatically is not part of the design of standard CloudFront behavior, where Path Patterns in Cache Behaviors determine which origin is used for each request. There are several ways of emulating the behavior, using Lambda@Edge trigger hooks to modify CloudFront's behavior while each individual request is in flight, but the applicability of these (and which approach to use) depends on a lot of different factors, like object size, latency constraints, and the acceptability of occasional browser redirects with query parameters. Can you give any more insight into your application? – Michael - sqlbot Sep 20 '18 at 12:29
  • It was to help our frontend team manage testing staging and live environments. They're going to work around it differently because it doesn't look like Cloudfront supports this. – Andy Sep 21 '18 at 13:28

0 Answers0