Skip to content
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

No 'Access-Control-Allow-Origin' header is present on the requested resource #15

Closed
Jeka-Dem opened this issue May 30, 2018 · 4 comments
Assignees
Labels
Milestone

Comments

@Jeka-Dem
Copy link

Hi guys!
I've an question about CORS:
On the main page there is a string "Cross-origin resource sharing (CORS)" in tool features description
But in documentation I can't find any info to how implement it / enable it
I have Kubernetes Cluster with some micro-services and deployed and configured KrakenD in front of them, when I send some request to service endpoint I get error in Chrome console:
"Failed to load https://integration.****.com/*: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://dev.' is therefore not allowed access. The response had HTTP status code 500."
I can try configure Kube Ingress to handle it, but I want to enable it in KrakenD
So, how I can implement it?
Thanks!

@kpacha
Copy link
Member

kpacha commented Jun 1, 2018

Hi, @Jeka-Dem ,

The CORS module is not included in the released CE versions by default as it is problematic in the activation/desactivation. To use it you need to add it manually as in https://github.com/devopsfaith/krakend-examples/blob/053b842129fd984a36a8549ba124ffab70613283/jwt/main.go#L79

cheers

@alombarte
Copy link
Member

We need to correct the page, noted.

Thanks for reporting @Jeka-Dem

@kpacha kpacha added this to the 0.6 milestone Jun 4, 2018
@taik0
Copy link
Member

taik0 commented Jun 5, 2018

Hi @Jeka-Dem we just created a CORS module so you can use it with your KrakenD installation.
To enable it in KrakenD-ce you should add the middleware in this line:
https://github.com/devopsfaith/krakend-ce/blob/master/executor.go#L38
With an statement like:

import krakendcors "github.com/devopsfaith/krakend-cors/gin"
...
corsMw := krakendcors.New(cfg.ExtraConfig)
...
MiddleWares: []gin.HandlerFunc{corsMw}
...

This example is for gin, you can use the mux adapter too.

@github-actions
Copy link

github-actions bot commented Apr 9, 2022

This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link.

@github-actions github-actions bot added the locked label Apr 9, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants