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

This commit is contained in:
Jonathan Brown 2016-10-03 18:18:46 +07:00
parent ab7adb0027
commit ae341b31c8

View File

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