http: enable methods used with WebDAV - fixes #7444

Without this, requests like PROPFIND, issued from a browser, fail.
This commit is contained in:
Alen Šiljak 2023-11-22 13:23:34 +01:00 committed by Nick Craig-Wood
parent ba11040d6b
commit 5fba502516
2 changed files with 2 additions and 2 deletions

View File

@ -183,8 +183,8 @@ func MiddlewareCORS(allowOrigin string) Middleware {
if allowOrigin != "" {
w.Header().Add("Access-Control-Allow-Origin", allowOrigin)
w.Header().Add("Access-Control-Request-Method", "POST, OPTIONS, GET, HEAD")
w.Header().Add("Access-Control-Allow-Headers", "authorization, Content-Type")
w.Header().Add("Access-Control-Allow-Methods", "COPY, DELETE, GET, HEAD, LOCK, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PROPPATCH, PUT, TRACE, UNLOCK")
}
next.ServeHTTP(w, r)

View File

@ -323,8 +323,8 @@ func TestMiddlewareAuthCertificateUser(t *testing.T) {
var _testCORSHeaderKeys = []string{
"Access-Control-Allow-Origin",
"Access-Control-Request-Method",
"Access-Control-Allow-Headers",
"Access-Control-Allow-Methods",
}
func TestMiddlewareCORS(t *testing.T) {