Skip to content

added CORS support #26

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

Closed
wants to merge 2 commits into from
Closed

added CORS support #26

wants to merge 2 commits into from

Conversation

peilin
Copy link
Contributor

@peilin peilin commented Apr 16, 2015

This is for using snoop swagger UI from another server (e.g. apollo-api). You will need to add
origin = "http://apollo-api:8000" to the swagger section in snoop.conf.

I believe this should work. However due to the hardship setting up a proxy server locally, testing was limited.

According to this post swagger-api/swagger-ui#343, the apollo-api server may need to add useJQuery:true and xhr.withCredentials=true when initializing SwaggerUI in order to send along the cookie, eg :

new SwaggerUi({
url: "/api-docs",
dom_id: "swagger-ui-container",
useJQuery: true,
beforeSend: function(xhr){
xhr.withCredentials = true;
}
...

implicit def executionContext = actorRefFactory.dispatcher
def actorRefFactory = context
def possibleRoutes = baseRoute ~ workflowRoutes ~ swaggerService.routes
def possibleRoutes = cors { baseRoute ~ workflowRoutes ~ swaggerService.routes }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want cors for all of our routes or just swagger?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do, otherwise you get the no allow-origin header when you make a request

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lose the extra whitespace

@TheXardas
Copy link

Is it going to be merged?

@peilin peilin closed this Nov 18, 2016
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.

4 participants