add header to access-control-allow-headers

This commit is contained in:
David Christofas committed 2020-03-30 14:58:40 +02:00
1 parent 6a3afe2aac
commit 3b8809c990
2 files changed
+6 -1

No files matched your search

@@ -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
+1 -1
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)