feat: update default CORS settings

This commit is contained in:
Henrique Dias
2026-02-15 14:02:31 +01:00
parent 04070a8ae8
commit e06f26b095
2 changed files with 26 additions and 8 deletions
+24 -6
View File
@@ -128,18 +128,36 @@ log:
# CORS configuration # CORS configuration
cors: cors:
# Whether or not CORS configuration should be applied. Default is 'false'. # Whether or not CORS configuration should be applied. Default is 'false'.
# This is an example of how you can enable CORS.
enabled: true enabled: true
credentials: true credentials: true
allowed_headers: # The following are the default CORS settings when it is enabled.
- Depth
allowed_hosts: allowed_hosts:
- * - *
allowed_headers:
- Authorization
- Content-Type
- Depth
- Destination
- If
- Lock-Token
- Overwrite
- TimeOut
- Translate
allowed_methods: allowed_methods:
- COPY
- DELETE
- GET - GET
exposed_headers: - HEAD
- Content-Length - LOCK
- Content-Range - UNLOCK
- MKCOL
- MOVE
- OPTIONS
- POST
- PROPFIND
- PROPPATCH
- PUT
exposed_headers: []
# You define here the list of users. # You define here the list of users.
# Basic authentication is automatically be configured when users are detected # Basic authentication is automatically be configured when users are detected
+2 -2
View File
@@ -86,9 +86,9 @@ func ParseConfig(filename string, flags *pflag.FlagSet) (*Config, error) {
v.SetDefault("Log.Format", "console") v.SetDefault("Log.Format", "console")
v.SetDefault("Log.Outputs", []string{"stderr"}) v.SetDefault("Log.Outputs", []string{"stderr"})
v.SetDefault("Log.Colors", true) v.SetDefault("Log.Colors", true)
v.SetDefault("CORS.Allowed_Headers", []string{"*"})
v.SetDefault("CORS.Allowed_Hosts", []string{"*"}) v.SetDefault("CORS.Allowed_Hosts", []string{"*"})
v.SetDefault("CORS.Allowed_Methods", []string{"*"}) v.SetDefault("CORS.Allowed_Headers", []string{"Authorization", "Content-Type", "Depth", "Destination", "If", "Lock-Token", "Overwrite"})
v.SetDefault("CORS.Allowed_Methods", []string{"COPY", "DELETE", "GET", "HEAD", "LOCK", "MKCOL", "MOVE", "OPTIONS", "POST", "PROPFIND", "PROPPATCH", "PUT", "UNLOCK"})
// Read and unmarshal configuration // Read and unmarshal configuration
err := v.ReadInConfig() err := v.ReadInConfig()