Add CORS to bskyweb (#5221)

This commit is contained in:
Jaz
2024-09-09 10:39:28 -07:00
committed by GitHub
parent f240893980
commit 9e1eb1f9f1
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -57,6 +57,7 @@ func serve(cctx *cli.Context) error {
linkHost := cctx.String("link-host")
ipccHost := cctx.String("ipcc-host")
basicAuthPassword := cctx.String("basic-auth-password")
corsOrigins := cctx.StringSlice("cors-allowed-origins")
// Echo
e := echo.New()
@@ -168,6 +169,12 @@ func serve(cctx *cli.Context) error {
RedirectCode: http.StatusFound,
}))
// CORS middleware
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: corsOrigins,
AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodOptions},
}))
//
// configure routes
//