adapt cors headers
Signed-off-by: Christian Richter <crichter@owncloud.com> Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
@@ -26,7 +26,7 @@ func DefaultConfig() *config.Config {
|
||||
Root: "/graph/v1.0",
|
||||
Namespace: "com.owncloud.graph",
|
||||
CORS: config.CORS{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedOrigins: []string{"https://localhost:9200"},
|
||||
},
|
||||
},
|
||||
Service: config.Service{
|
||||
@@ -77,6 +77,11 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
} else if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &config.TokenManager{}
|
||||
}
|
||||
|
||||
if cfg.HTTP.CORS.AllowedOrigins == nil && cfg.Commons != nil && cfg.Commons.OcisURL != "" ||
|
||||
len(cfg.HTTP.CORS.AllowedOrigins) == 1 && cfg.HTTP.CORS.AllowedOrigins[0] == "https://localhost:9200" {
|
||||
cfg.HTTP.CORS.AllowedOrigins = []string{cfg.Commons.OcisURL}
|
||||
}
|
||||
}
|
||||
|
||||
func Sanitize(cfg *config.Config) {
|
||||
|
||||
Reference in New Issue
Block a user