Skip to content

Commit dc17352

Browse files
committed
CORS
1 parent a89c220 commit dc17352

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmd/jetstream/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/bluesky-social/jetstream/pkg/server"
2121
"github.com/gorilla/websocket"
2222
"github.com/labstack/echo/v4"
23+
"github.com/labstack/echo/v4/middleware"
2324
"github.com/prometheus/client_golang/prometheus/promhttp"
2425

2526
"github.com/urfave/cli/v2"
@@ -212,6 +213,10 @@ func Jetstream(cctx *cli.Context) error {
212213
}
213214

214215
e := echo.New()
216+
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
217+
AllowOrigins: []string{"*"},
218+
AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodOptions},
219+
}))
215220
e.GET("/", func(c echo.Context) error {
216221
return c.String(http.StatusOK, "Welcome to Jetstream")
217222
})

0 commit comments

Comments
 (0)