diff --git a/apiService.go b/apiService.go index 4d7bf43..b472140 100644 --- a/apiService.go +++ b/apiService.go @@ -12,6 +12,14 @@ import ( func APIService(c ClustersToRun) { runCluster := func(mode ConnectionMode, host string, hostSSL string, key string, crt string) { router := gin.Default() + router.Use(cors.New(cors.Config{ + AllowOrigins: []string{"https://explorer.atlasnet.staratlas.cloud"}, + AllowMethods: []string{"GET"}, + AllowHeaders: []string{"Origin"}, + ExposeHeaders: []string{"Content-Length"}, + AllowCredentials: true, + MaxAge: 12 * time.Hour, + })) router.GET("/:cluster/latest", getLatest) router.GET("/:cluster/last6hours", timeout.New(timeout.WithTimeout(10*time.Second), timeout.WithHandler(last6hours))) router.GET("/:cluster/last6hours/nocomputeprice", timeout.New(timeout.WithTimeout(10*time.Second), timeout.WithHandler(last6hoursNoPrice)))