-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Defining CORS when ApiKeyRequired is true results in an OPTIONS method that requires an API key #1786
Comments
We have a According to Fetch Standard
OPTIONS endpoint should work without the need for credential. Propose: not apply |
While this issue is being resolved, are there suggested work-arounds? |
potential workarounds:
|
I would also be happy to see a solution for this. Right now I am using a generic function which responds to OPTIONS requests with a 200 and the necessary CORS headers. Sadly I cannot use /{proxy+} for that function (I tried it) so I have to add all my functions paths to the events section one by one. To me that seems like a bit of overhead. Thanks in advance. |
How do I define the sam template to exclude ApiKeyRequired: true for OPTIONS.
When we set api key as true, why does aws sam expects the api key for options too. This issue is open for more than a year. Any progress on this? |
@aahung @CoshUS @wchengru Any updates on this? Problem: We use ApiKey in REST ApiGateway and when we automate using SAM with Due to this blocking issue, we're unable to use SAM to proceed further and our company asked us to use alternate. But I feel it would be good if we can proceed with SAM. Please help on this blocking issue. |
I was struggling with this issue for 3 days...
|
This solution worked for me: |
I agree this is broken functionality. There is no scenario where auth works on an OPTIONS request and so should be omitted (with a note in the docs) from the final deployment. I was able to work around this in a different way: API Definition... I commented out or removed
And then for each function event I added the
This resulted in the following in the console: Basically the best way to do this is not to enforce
My feedback to the maintainers is the following:
|
#2981 merged; will roll out over coming weeks. |
Description:
When setting up an API Gateway with {proxy+} integration through SAM, having a required API key prevents the CORS definition from properly responding to OPTIONS requests, since they require an API key as well.
Steps to reproduce the issue:
Observed result:
The
OPTIONS
method in API Gateway requires an API Key, blocking CORS since browsers don't add ax-api-key
header.Expected result:
The
OPTIONS
method should not require an API Key.The text was updated successfully, but these errors were encountered: