Avoid resetting Cloudfront cache policy on Amplify deployment

0

I have a NextJS application with continuous deploys set up on Amplify. This application requires forwarding the Host header to the origin, so I use the "Amplify" managed cache policy as the Cloudfront's distribution default behaviour.

This cache policy is reset to legacy cache settings on each deploy. Is there a way to persist the cache policy between deployments? Or to always forward the Host header to the origin?

已提問 2 年前檢視次數 854 次
1 個回答
0

If you require that the host header be sent to the origin, but don't care if it is included in the cache key, then you can use the AllViewer origin request policy in your CloudFront distribution. That will ensure that all headers, cookies, and query strings are forwarded to the origin, regardless of the settings in the cache policy.

The issue with the cache policy being reset is interesting, and that should not be happening. I would reach out to support, as they should be able to investigate why that is happening.

profile pictureAWS
已回答 2 年前
  • Is this method still available in 2023

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南