Skip to content

fix(local): add CORS headers to HTTP API authorizer failure responses - #9476

Open
Aaroh-Mystogan wants to merge 2 commits into
aws:developfrom
Aaroh-Mystogan:fix/9087-http-authorizer-cors
Open

Aaroh-Mystogan wants to merge 2 commits into
aws:developfrom
Aaroh-Mystogan:fix/9087-http-authorizer-cors

Conversation

@Aaroh-Mystogan

Copy link
Copy Markdown

Which issue(s) does this change fix?

#9087

Why is this change necessary?

sam local start-api only adds CORS headers to successful responses. When a Lambda authorizer denies a request (or the identity source is missing), the browser gets a CORS error instead of the real 401/403, which doesn't match deployed HTTP API behavior.

How does it address the issue?

It applies the route's CORS headers to the two authorizer-failure responses in _request_handler, for HTTP APIs only. REST APIs are unchanged, since they use GatewayResponses.

What side effects does this change have?

None when CORS isn't configured. REST API error responses are unchanged.

Mandatory Checklist

PRs will only be reviewed after checklist is complete

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Aaroh-Mystogan
Aaroh-Mystogan requested a review from a team as a code owner December 1, 2026 23:42
@github-actions github-actions Bot added area/local/start-api sam local start-api command area/local/invoke sam local invoke command area/local/start-invoke pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/local/invoke sam local invoke command area/local/start-api sam local start-api command area/local/start-invoke pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant