From c37f7ea279a9de045ee454cb33639b0854e51141 Mon Sep 17 00:00:00 2001 From: Julian Sommer <115516918+juliansommer@users.noreply.github.com> Date: Mon, 12 Jan 2026 02:04:46 +0000 Subject: [PATCH] add cors --- hive/gateway/gateway.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hive/gateway/gateway.go b/hive/gateway/gateway.go index 62dd9648a..1f458c271 100644 --- a/hive/gateway/gateway.go +++ b/hive/gateway/gateway.go @@ -8,6 +8,7 @@ import ( "strings" "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2/middleware/cors" "github.com/gofiber/fiber/v2/middleware/logger" "github.com/google/uuid" "github.com/mulgadc/hive/hive/awsec2query" @@ -100,6 +101,14 @@ func (gw *GatewayConfig) SetupRoutes() *fiber.App { return nil } + // Add CORS middleware for browser requests + app.Use(cors.New(cors.Config{ + AllowOrigins: "http://localhost:3000", + AllowMethods: "GET,POST,PUT,DELETE,HEAD,OPTIONS", + AllowHeaders: "*", + AllowCredentials: true, + })) + // Add authentication middleware for all requests app.Use(s3.SigV4AuthMiddleware)