Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(aws-amplify): make customHeaders configurable. #17084

Closed
1 of 2 tasks
hedrall opened this issue Oct 20, 2021 · 3 comments · Fixed by #17102
Closed
1 of 2 tasks

(aws-amplify): make customHeaders configurable. #17084

hedrall opened this issue Oct 20, 2021 · 3 comments · Fixed by #17102
Labels
@aws-cdk/aws-amplify Related to AWS Amplify effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p1

Comments

@hedrall
Copy link
Contributor

hedrall commented Oct 20, 2021

Description

Configuring customHeaders in Amplify is possible in CloudFormation, but not yet supported in the construct library.

CF: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amplify-app.html#cfn-amplify-app-customheaders

Use Case

Configure custom headers of application. (ex: security headers). We also can configure with customHeaders.yml file on root directory of git repository, but in this case, we cannot switch easily for each environments.

Proposed Solution

Make configurable in App construct class.

Other information

No response

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change
@hedrall hedrall added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 20, 2021
@github-actions github-actions bot added the @aws-cdk/aws-amplify Related to AWS Amplify label Oct 20, 2021
@ryparker ryparker added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Oct 20, 2021
@ayush987goyal
Copy link
Contributor

@skinny85 @ryparker Is it okay to take a dependency on js-yaml package to add this feature with better customer experience? Currently the CFN spec for amplify app only allows a string to be passed for custom headers and that can get pretty cumbersome for customers to pass as string (ref)

Eg: "customHeaders:\n- pattern: '**/*'\n headers:\n - key: 'foo'\n value: 'updated'\n"

If we use the above package, we can provide a better API for the customer that accepts an array of objects with the required details.

@skinny85
Copy link
Contributor

@ayush987goyal sure, except substitute js-yaml with the yaml package instead, as we already use it in the CDK 🙂.

@skinny85 skinny85 added the in-progress This issue is being actively worked on. label Oct 22, 2021
@skinny85 skinny85 removed their assignment Oct 22, 2021
@mergify mergify bot closed this as completed in #17102 Oct 25, 2021
mergify bot pushed a commit that referenced this issue Oct 25, 2021
feat(amplify): Add support for custom headers in the App

closes #17084 

Refs:
1. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amplify-app.html#cfn-amplify-app-customheaders
2. https://docs.aws.amazon.com/amplify/latest/userguide/custom-headers.html
3. https://www.npmjs.com/package/yaml

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-amplify Related to AWS Amplify effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants