🐛 Update CORS settings

This commit is contained in:
LittleSheep 2024-09-16 18:00:09 +08:00
parent ecf8c574e4
commit b9fd5741f3

View File

@ -1,8 +1,6 @@
package server package server
import ( import (
"strings"
"git.solsynth.dev/hydrogen/dealer/pkg/internal/server/api" "git.solsynth.dev/hydrogen/dealer/pkg/internal/server/api"
"git.solsynth.dev/hydrogen/dealer/pkg/internal/server/exts" "git.solsynth.dev/hydrogen/dealer/pkg/internal/server/exts"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
@ -34,15 +32,7 @@ func NewServer() *HTTPApp {
app.Use(idempotency.New()) app.Use(idempotency.New())
app.Use(cors.New(cors.Config{ app.Use(cors.New(cors.Config{
AllowCredentials: true, AllowCredentials: true,
AllowMethods: strings.Join([]string{ AllowMethods: "GET,POST,HEAD,PUT,DELETE,PATCH",
fiber.MethodGet,
fiber.MethodPost,
fiber.MethodHead,
fiber.MethodOptions,
fiber.MethodPut,
fiber.MethodDelete,
fiber.MethodPatch,
}, ","),
AllowOriginsFunc: func(origin string) bool { AllowOriginsFunc: func(origin string) bool {
return true return true
}, },