瀏覽代碼

rpc: set CORS Max-Age to reduce preflight OPTIONS requests

Jonathan Brown 9 年之前
父節點
當前提交
ae341b31c8
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      rpc/http.go

+ 1 - 0
rpc/http.go

@@ -170,6 +170,7 @@ func newCorsHandler(srv *Server, corsString string) http.Handler {
 	c := cors.New(cors.Options{
 		AllowedOrigins: allowedOrigins,
 		AllowedMethods: []string{"POST", "GET"},
+		MaxAge: 600,
 	})
 	return c.Handler(srv)
 }