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

fix cors #16

Merged
merged 1 commit into from Apr 5, 2021
Merged

fix cors #16

merged 1 commit into from Apr 5, 2021

Conversation

techno-tanoC
Copy link
Owner

@techno-tanoC techno-tanoC commented Apr 5, 2021

Had the same problem.
Solved it by registering the middleware with router.Use(cors.Default()) BEFORE registering any routes
gin-contrib/cors#29 (comment)

See below, The line r.Use must come before the r.GET. If it was the other way, I didn't get the Access-Control-Allow-Headers header set.
gin-contrib/cors#73 (comment)

@techno-tanoC techno-tanoC merged commit 3ee6069 into main Apr 5, 2021
@techno-tanoC techno-tanoC deleted the fix-cors branch April 5, 2021 15:22
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.

None yet

1 participant