Next.js + AWS Amplify Authorization Header

Viewed 114

I currently have a Next.js app deployed on Amplify which is a mixture of a SPA and API endpoints.

Some of the API endpoints require authorization, and the client is providing a Authorization access token in the request header to handle this.

By default when I deploy to Amplify, the associated cloudfront settings do not allow an Authorization header and I need to change this is the Cloudfront settings to allow it.

Cloudfront -> Cache key and origin requests -> Legacy cache settings -> Headers

Once I change this setting to allow Authorization headers everything works well, but everytime Amplify redploys the Cloudfront settings are reverted.

Is there a way to manage the Cloudfront settings from Amplify?

Or a way to retain the Cloudfront settings?

Thanks

0 Answers
Related