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?

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

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ