From cd9de6d578ae577429f16ae219e6b618ee271860 Mon Sep 17 00:00:00 2001 From: Jacob Gunther Date: Mon, 5 Feb 2024 22:58:20 -0600 Subject: [PATCH] Make CORS used outside of development env --- src/routes.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/routes.go b/src/routes.go index 0a99c69..4d35b7f 100644 --- a/src/routes.go +++ b/src/routes.go @@ -25,13 +25,13 @@ func init() { Data: assets.Favicon, })) - if config.Environment == "development" { - app.Use(cors.New(cors.Config{ - AllowOrigins: "*", - AllowMethods: "HEAD,OPTIONS,GET", - ExposeHeaders: "X-Cache-Hit,X-Cache-Time-Remaining", - })) + app.Use(cors.New(cors.Config{ + AllowOrigins: "*", + AllowMethods: "HEAD,OPTIONS,GET,POST", + ExposeHeaders: "X-Cache-Hit,X-Cache-Time-Remaining", + })) + if config.Environment == "development" { app.Use(logger.New(logger.Config{ Format: "${time} ${ip}:${port} -> ${status}: ${method} ${path} (${latency})\n", TimeFormat: "2006/01/02 15:04:05",