-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(apigateway): set passthrough behavior to avoid errors on CORS preflight requests #30985
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
Conversation
Set `passthroughBehavior` behavior to `NEVER` to prevent errors for CORS preflight requests with content-types other than `application/json`.
aws-cdk-automation
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.
|
Clarification Request if test cases are required. No "code changes", just changed a mock integration setting. |
|
Hi @takeshixx, apologies for the late response. As discussed, please add a unit test case for this change and run the integ tests to update any snapshots. |
|
This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
I have added a unit test that calls cd packages/aws-cdk-list
yarn build
yarn testAnd the test ran without errors. Is there anything else that is missing? |
|
This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error. |
|
Comments on closed issues and PRs are hard for our team to see. |
|
The pull request linter fails with the following errors: PRs must pass status checks before we can provide a meaningful review. If you would like to request an exemption from the status checks or clarification on feedback, please leave a comment on this PR containing |
Set
passthroughBehaviorbehavior toNEVERto prevent errors for CORS preflight requests with content-types other thanapplication/json.Issue # (if applicable)
This was reported as #18297, but it was closed without a fix.
Reason for this change
Using
addCorsPreflight()will add a mock integration forOPTIONSrequests and maps them to content-typeapplication/json.OPTIONSrequests with a content-type header other thanapplication/jsonlead to HTTP 500 Internal Server Errors.Description of changes
Setting the
passthroughBehaviortoNEVERreturns a mime type error instead of a internal server error, which is the appropriate response.It should be noted that this setting was proposed in the initial implementation of
addCorsPreflight()in #906 already. However, it looks like it didn't make it into the CDK. Instead the default configuration is use, which sets it toWHEN_NO_MATCH.Description of how you validated changes
I tested the change by manually overriding the
passthroughBehavioron theLambdaRestApiresource:Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license