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?

preguntada hace 2 años860 visualizaciones
1 Respuesta
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
respondido hace 2 años
  • Is this method still available in 2023

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas