+
+func ServeCORSPreflight(w http.ResponseWriter, header http.Header) bool {
+ method := header.Get("Access-Control-Request-Method")
+ if method == "" {
+ return false
+ }
+ if !browserMethod[method] && !webdavMethod[method] {
+ w.WriteHeader(http.StatusMethodNotAllowed)
+ return true
+ }
+ w.Header().Set("Access-Control-Allow-Headers", corsAllowHeadersHeader)
+ w.Header().Set("Access-Control-Allow-Methods", "COPY, DELETE, GET, LOCK, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PROPPATCH, PUT, RMCOL, UNLOCK")
+ w.Header().Set("Access-Control-Allow-Origin", "*")
+ w.Header().Set("Access-Control-Max-Age", "86400")
+ return true
+}