diff options
author | Pacien TRAN-GIRARD | 2012-09-22 14:42:41 +0200 |
---|---|---|
committer | Pacien | 2015-12-07 22:48:25 +0100 |
commit | 229e5cd4bc19dea736200330e4f30dec860024fa (patch) | |
tree | 801b9c39af83ac09ab14eec7bd7945242713ce08 | |
parent | 81ea937ae17364208e41a6b103f5091382d4b7b0 (diff) | |
download | ninja-go-local-cloud-229e5cd4bc19dea736200330e4f30dec860024fa.tar.gz |
Add some Access-Control headers.
-rw-r--r-- | src/ninjacloud.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ninjacloud.go b/src/ninjacloud.go index 54027d4..58146f7 100644 --- a/src/ninjacloud.go +++ b/src/ninjacloud.go | |||
@@ -279,6 +279,10 @@ func listDir(path string, recursive bool, filter []string, returnType string) (l | |||
279 | 279 | ||
280 | func fileHandler(w http.ResponseWriter, r *http.Request) { | 280 | func fileHandler(w http.ResponseWriter, r *http.Request) { |
281 | w.Header().Add("Cache-Control", "no-cache") | 281 | w.Header().Add("Cache-Control", "no-cache") |
282 | w.Header().Add("Access-Control-Allow-Headers", "Content-Type, sourceURI, overwrite-destination, check-existence-only, recursive, return-type, operation, delete-source, file-filters, if-modified-since, get-file-info") | ||
283 | w.Header().Add("Access-Control-Allow-Methods", "POST, GET, DELETE, PUT") | ||
284 | w.Header().Add("Access-Control-Allow-Origin", "*/*") | ||
285 | w.Header().Add("Access-Control-Max-Age", "86400") | ||
282 | p := filepath.Clean(r.URL.Path[filePathLen:]) | 286 | p := filepath.Clean(r.URL.Path[filePathLen:]) |
283 | p = strings.TrimLeft(p, driveName) | 287 | p = strings.TrimLeft(p, driveName) |
284 | p = strings.TrimLeft(p, "/") | 288 | p = strings.TrimLeft(p, "/") |
@@ -461,6 +465,10 @@ func fileHandler(w http.ResponseWriter, r *http.Request) { | |||
461 | 465 | ||
462 | func dirHandler(w http.ResponseWriter, r *http.Request) { | 466 | func dirHandler(w http.ResponseWriter, r *http.Request) { |
463 | w.Header().Add("Cache-Control", "no-cache") | 467 | w.Header().Add("Cache-Control", "no-cache") |
468 | w.Header().Add("Access-Control-Allow-Headers", "Content-Type, sourceURI, overwrite-destination, check-existence-only, recursive, return-type, operation, delete-source, file-filters, if-modified-since, get-file-info") | ||
469 | w.Header().Add("Access-Control-Allow-Methods", "POST, GET, DELETE, PUT") | ||
470 | w.Header().Add("Access-Control-Allow-Origin", "*/*") | ||
471 | w.Header().Add("Access-Control-Max-Age", "86400") | ||
464 | p := filepath.Clean(r.URL.Path[dirPathLen:]) | 472 | p := filepath.Clean(r.URL.Path[dirPathLen:]) |
465 | p = strings.TrimLeft(p, driveName) | 473 | p = strings.TrimLeft(p, driveName) |
466 | p = strings.TrimLeft(p, "/") | 474 | p = strings.TrimLeft(p, "/") |