Search code examples
amazon-web-servicesamazon-cloudfront

AWS Cloudfront multiple behaviors


I am configuring AWS CloudFront. I have two backend routes

/api/v3/test1/stats
/api/v3/test2/theme 

I created 2 behaviors

/api/v3/*/stats
/api/v3/*/theme 

I am using pre-defined policy CachingOptimizing for both of them. After AWS CF deployed both of these routes returned error 502. When I remove rules or remove even one rule - routes work as expected. I try to use Legacy Cache Settings and set None for all attributes and catch the same error. What's wrong with such config and how to manage multiple routes with wildcard?


Solution

  • The issue was, that if you create multiple behaviors without Origin request policy and using wildcard - AWS CF returned error 502. After I created and used a custom policy, the issue was fixed.