Skip to content

WIP: Implemented support for CORS in start-api command#1009

Closed
devoto13 wants to merge 1 commit intoaws:developfrom
devoto13:cors-support
Closed

WIP: Implemented support for CORS in start-api command#1009
devoto13 wants to merge 1 commit intoaws:developfrom
devoto13:cors-support

Conversation

@devoto13
Copy link

Issue #, if available:

#323

Description of changes:

This adds a basic support for CORS in start-api command. Currently it only understands format specified in SAM and doesn't understand explicit definition with x-amazon-apigateway-integration with type=mock. I believe that this should solve most of the use cases and support for the explicit specification can be added at the later stage as it is a more complex task.

At this stage I'm looking for the confirmation that the direction is right and if so I'll proceed with a cleanup, tests and documentation.

Checklist:

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

@sanathkr sanathkr self-requested a review February 19, 2019 19:36
@sanathkr sanathkr self-assigned this Feb 19, 2019
@devoto13
Copy link
Author

Just a short updated on this. I've used cors property of the Route class, because it was already there, but after some thinking it seems that the better idea is to remove the property and instead introduce two subclasses for Route: one for Lambda integration and another one for the CORS response (which is essentially a quite limited type=mock integration, which can later be extended).

Then the implementation will add a new OPTIONS route for every unique path and if this route is hit, it will respond with the CORS headers specified in the SAM.

@devoto13
Copy link
Author

devoto13 commented Jun 1, 2019

I switched to another project and won't have time to move this forward in the near future, so closing the PR. There is a decent workaround described in #323 (comment).

@devoto13 devoto13 closed this Jun 1, 2019
viksrivat added a commit to viksrivat/aws-sam-cli that referenced this pull request Jun 26, 2019
… feature/cors_support

Add cors support using aws#1009 as a ref
@viksrivat viksrivat mentioned this pull request Jun 26, 2019
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants