Skip to content

Commit

Permalink
Merge pull request #42 from owncloud/add-header-to-allowed-headers
Browse files Browse the repository at this point in the history
add header to access-control-allow-headers
  • Loading branch information
C0rby authored Mar 30, 2020
2 parents 6a3afe2 + 3b8809c commit 6f34534
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/unreleased/add-header-to-cors-handler.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion middleware/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6f34534

Please sign in to comment.