Merge pull request #42 from owncloud/add-header-to-allowed-headers

add header to access-control-allow-headers
This commit is contained in:
David Christofas
2020-03-30 16:01:59 +02:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
Change: Add header to cors handler
The `x-requested-with` header was added to allow ajax requests.
https://github.com/owncloud/ocis-pkg/issues/41

View File

@@ -24,7 +24,7 @@ func Cors(next http.Handler) http.Handler {
} else {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "authorization, origin, content-type, accept")
w.Header().Set("Access-Control-Allow-Headers", "authorization, origin, content-type, accept, x-requested-with")
w.Header().Set("Allow", "HEAD, GET, POST, PUT, PATCH, DELETE, OPTIONS")
w.WriteHeader(http.StatusOK)