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 Risposta
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
con risposta 2 anni fa
  • Is this method still available in 2023

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande