- Newest
- Most votes
- Most comments
It seems you're experiencing an issue with your customHttp.yml file not being applied in AWS Amplify. This is a concerning situation, especially given the importance of custom headers like content security policy.
First, it's important to note that the customHttp.yml file should indeed work across all branches, as you've correctly observed. It's not branch-specific, which is why you're seeing the issue on both your staging and master branches.
The fact that updating the custom headers in the UI and redeploying didn't resolve the issue suggests that there might be a problem with how Amplify is processing your configuration file. Here are a few steps you can try to troubleshoot and potentially resolve the issue:
-
Verify the location of your customHttp.yml file. It should be in the root of your project directory.
-
Double-check the syntax and formatting of your customHttp.yml file. Even small errors can cause the file to be ignored.
-
Try renaming the file to amplify.yml and include your custom headers under a 'customHeaders' section. This is an alternative way to specify custom headers that might work if the customHttp.yml file is being overlooked for some reason.
-
Attempt to invalidate the cache for your Amplify app. You can do this through the Amplify Console or using the Amplify CLI command 'amplify cache invalidate'.
-
If possible, try creating a new branch from your master, make a small change, and deploy it to see if the custom headers are applied correctly on a fresh deployment.
-
Check your build logs for any warnings or errors related to custom headers or the customHttp.yml file.
If none of these steps resolve the issue, it would be advisable to contact AWS support, as there might be an underlying problem with how Amplify is handling your configuration.
Regarding your concern about updating production, it would be wise to thoroughly test any changes on your staging environment first. If you're still unable to get the custom headers working on staging, it might be best to hold off on updating production until the issue is resolved to avoid potentially losing your custom headers in the production environment.
Remember, any changes to your security headers, especially the Content Security Policy, should be carefully tested to ensure they don't break any functionality of your site while still providing the necessary security.
Sources
Issue with AWS Amplify Deployment on Custom Domain | AWS re:Post
AWS Amplify FAQs | Front-End Web & Mobile | Amazon Web Services
answered 2 years ago
So I think that I have solved this based on the AI answer. I was using the yaml multi line format with the folded symbol. Apparently Amplify does not like this format and rejected it. When I put it back to all on one line it worked again.
answered 2 years ago
Relevant content
asked 7 years ago
- AWS OFFICIALUpdated 5 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 2 years ago
