-
Notifications
You must be signed in to change notification settings - Fork 30
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
Added the ability to use CORS for all sources #27
Conversation
Hi all!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to enable cors add rs/cors dependency and use that handler instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also add, allowedorigins can be skipped for now, because we can take those as options
--allowed-cors-origins "http://example.com,http://example2.com"
opts := cors.Options{
AllowOriginFunc: func(origin string) bool {
if allowedCorsOrigin == "" {
return true
}
for _, allowedOrigin := range strings.Split(allowedCorsOrigin, ",") {
if wildcard.MatchSimple(allowedOrigin, origin) {
return true
}
}
return false
},
AllowedMethods: []string{
http.MethodGet,
http.MethodPut,
http.MethodHead,
http.MethodPost,
http.MethodDelete,
http.MethodOptions,
http.MethodPatch,
},
AllowedHeaders: []string{"*"},
ExposedHeaders: []string{"*"},
AllowCredentials: true,
}
return cors.New(opts).Handler(handler)
@harshavardhana hi! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me think about this.
go.mod
Outdated
@@ -5,6 +5,8 @@ go 1.18 | |||
require ( | |||
github.com/caddyserver/certmagic v0.17.2 | |||
github.com/minio/minio-go/v7 v7.0.61 | |||
github.com/minio/pkg v1.7.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there is a problem we can't link this package here since minio/pkg
is AGPLv3
3215760
to
329bcf7
Compare
This is merged here b906d89 |
Enabled the ability to use CORS for all sources
Cross-Origin Resource Sharing (CORS)