Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

CORS on root resource #40

Closed
rnhurt opened this issue Apr 18, 2016 · 3 comments
Closed

CORS on root resource #40

rnhurt opened this issue Apr 18, 2016 · 3 comments

Comments

@rnhurt
Copy link

rnhurt commented Apr 18, 2016

I'm trying to add CORS support to the root "/" resource. However, the ApiResource requires a pathPart but doesn't accept a null "" or root "/" string. Is there a way to create CORS options without specifying a pathPart or is there a magic "null" pathPart that will create things at the root resource?

@carlnordenfelt
Copy link
Owner

Hi, the Root resource is already created by API gateway, I'm honestly not
sure it it's possible to manipulate but it would require a separate
resource type to do so.
What you can do is create a regular http method of type OPTIONS on the root
resource but then you have to make sure you add the allow-origin header on
the other methods on the root resource. Tedious....

I'll give this some thought and see what I come up with, enabling Cora on
the root resource makes perfect sense so it sh be supported :)
On mån 18 apr. 2016 at 15:44, Richard Hurt notifications@github.com wrote:

I'm trying to add CORS support to the root "/" resource. However, the
ApiResource requires a pathPart but doesn't accept a null "" or root "/"
string. Is there a way to create CORS options without specifying a pathPart
or is there a magic "null" pathPart that will create things at the root
resource?


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#40

@rnhurt
Copy link
Author

rnhurt commented Apr 18, 2016

Yes, that makes sense. I think creating the OPTIONS method on root might work. I'll give it a shot. :)

@carlnordenfelt
Copy link
Owner

From version 1.6.0 you can specify CORS config on the rest api, this config will be applied to the parent resource of the API. It works exactly the same way as CORS configuration on Custom::APIResource.
https://apigatewaycloudformation.bynordenfelt.com/#custom-RestApi

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants