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

gin.Default() didn't allow all origins actually #75

Open
Ianwu0812 opened this issue Apr 26, 2021 · 0 comments
Open

gin.Default() didn't allow all origins actually #75

Ianwu0812 opened this issue Apr 26, 2021 · 0 comments

Comments

@Ianwu0812
Copy link

Ianwu0812 commented Apr 26, 2021

If we want to allow all origins on CORS policy, we will find the code block on gin.Default().

func Default() gin.HandlerFunc {
	config := DefaultConfig()
	config.AllowAllOrigins = true
	return New(config)
}

The code block contains config.AllowAllOrigins = true, so we thought we don't have to change anything for allowing all origin, but we found something weird. We have to set AllowWildCard = true or AllowAllOrigin will not work, because AllowAllOrigin passes wildcard(*) on preflight request.

Maybe we should remove config.AllowAllOrigins = true from gin.Default()?

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

No branches or pull requests

1 participant