How to set Cache-Control Header in CloudFront?
You can add a Cache-Control header to your CloudFront instance without the use of functions.
- Go to AWS Console and navigate to the CloudFront instance
- Go to Policies -> Response Headers and click on “Create response header policy” under custom policies. If you have an existing policy edit it.
- In the next screen under Custom headers add, `Cache-Control` header along with the max age value you want. This value can be set to override origin if you want it.
- Now go to your Distribution and navigate to the Behaviours tab.
- In your default behaviour, under the Response headers policy select the one you just created.