1
0
Fork 0
forked from External/mediamtx

api, playback: add CORS headers on non-existing pages too (#1792) (#3410)

This commit is contained in:
Alessandro Ros 2024-05-30 14:29:05 +02:00 committed by GitHub
parent 1c2f95f609
commit f4b7f147a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -190,6 +190,7 @@ func (a *API) Initialize() error {
router := gin.New()
router.SetTrustedProxies(a.TrustedProxies.ToTrustedProxies()) //nolint:errcheck
router.NoRoute(a.middlewareOrigin, a.middlewareAuth)
group := router.Group("/", a.middlewareOrigin, a.middlewareAuth)
group.GET("/v3/config/global/get", a.onConfigGlobalGet)

View file

@ -43,7 +43,10 @@ type Server struct {
func (s *Server) Initialize() error {
router := gin.New()
router.SetTrustedProxies(s.TrustedProxies.ToTrustedProxies()) //nolint:errcheck
router.NoRoute(s.middlewareOrigin)
group := router.Group("/", s.middlewareOrigin)
group.GET("/list", s.onList)
group.GET("/get", s.onGet)