Skip to content

Commit

Permalink
fix: removed localhsot:* cors origin
Browse files Browse the repository at this point in the history
  • Loading branch information
KunalSin9h committed Feb 24, 2024
1 parent c9b99e0 commit 3c019d3
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions server/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ import (
//go:embed static/*
var frontendSource embed.FS

var defaultAllowOrigins = []string{
"localhost",
"127.0.0.1",
"0.0.0.0",
}

type LogWriter struct {
LogFile *os.File
Stream *core.LogsStreamSessions
Expand Down Expand Up @@ -108,14 +102,6 @@ func Serve(ln net.Listener, origins string, verboseOutput bool) error {
return err
}

config := cors.ConfigDefault

for _, o := range defaultAllowOrigins {
origins = fmt.Sprintf("%s, http://%s, https://%s, http://%s:*, https://%s:*", origins, o, o, o, o)
}

config.AllowOrigins = origins

app := fiber.New(fiber.Config{
AppName: fmt.Sprintf("MeltCD Server v%s", version.Version),

Expand All @@ -128,6 +114,8 @@ func Serve(ln net.Listener, origins string, verboseOutput bool) error {
},
})

config := cors.ConfigDefault
config.AllowOrigins = origins
app.Use(cors.New(config))
app.Use(recover.New())

Expand Down

0 comments on commit 3c019d3

Please sign in to comment.