mirror of
https://github.com/owncloud/ocis
synced 2026-04-26 17:55:24 +02:00
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:
@@ -38,7 +38,7 @@ func DefaultConfig() *config.Config {
|
||||
Protocol: "tcp",
|
||||
Prefix: "data",
|
||||
CORS: config.CORS{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedOrigins: []string{"https://localhost:9200"},
|
||||
AllowedMethods: []string{
|
||||
"POST",
|
||||
"HEAD",
|
||||
@@ -63,7 +63,7 @@ func DefaultConfig() *config.Config {
|
||||
"Upload-Incomplete",
|
||||
"Upload-Draft-Interop-Version",
|
||||
},
|
||||
AllowCredentials: true,
|
||||
AllowCredentials: false,
|
||||
ExposedHeaders: []string{
|
||||
"Upload-Offset",
|
||||
"Location",
|
||||
@@ -208,6 +208,11 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
if cfg.Tasks.PurgeTrashBin.UserID == "" && cfg.Commons != nil {
|
||||
cfg.Tasks.PurgeTrashBin.UserID = cfg.Commons.AdminUserID
|
||||
}
|
||||
|
||||
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}
|
||||
}
|
||||
}
|
||||
|
||||
// Sanitize sanitized the configuration
|
||||
|
||||
Reference in New Issue
Block a user