Skip to content

Commit 37c574a

Browse files
authored
Merge pull request #18 from hammercode-dev/fix/cors-error
Fix/cors error
2 parents 860e48a + 647d347 commit 37c574a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/serve_http.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ var serveHttpCmd = &cobra.Command{
6060
router := registerHandler(app)
6161

6262
// build cors
63-
muxCorsWithRouter := cors.AllowAll().Handler(router)
63+
muxCorsWithRouter := cors.New(cors.Options{
64+
AllowedOrigins: cfg.CORS_ALLOWED_ORIGINS,
65+
AllowedHeaders: cfg.CORS_ALLOWED_HEADERS,
66+
AllowedMethods: cfg.CORS_ALLOWED_METHODS,
67+
AllowCredentials: true,
68+
}).Handler(router)
6469

6570
srv := &http.Server{
6671
Addr: cfg.APP_PORT,

0 commit comments

Comments
 (0)