瀏覽代碼

Reduce number of preflight check to save network brandwidth

Pascal Noisette 4 年之前
父節點
當前提交
cdeb2a8fc0
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      api/middleware.go

+ 1 - 0
api/middleware.go

@@ -27,6 +27,7 @@ func (m *middleware) handleCORS(next http.Handler) http.Handler {
 		w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
 		w.Header().Set("Access-Control-Allow-Headers", "X-Auth-Token")
 		if r.Method == http.MethodOptions {
+			w.Header().Set("Access-Control-Max-Age", "3600")
 			w.WriteHeader(http.StatusOK)
 			return
 		}