Sfoglia il codice sorgente

Reduce number of preflight check to save network brandwidth

Pascal Noisette 4 anni fa
parent
commit
cdeb2a8fc0
1 ha cambiato i file con 1 aggiunte e 0 eliminazioni
  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
 		}