This commit is contained in:
2026-02-28 19:09:24 +01:00
parent b76d086824
commit 9d8d5a0804
2 changed files with 13 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
package http
import "net/http"
func CORSMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cross-Origin-Opener-Policy", "same-origin")
w.Header().Set("Cross-Origin-Embedder-Policy", "require-corp")
w.Header().Set("Cross-Origin-Resource-Policy", "same-origin")
next.ServeHTTP(w, r)
})
}
+1
View File
@@ -35,6 +35,7 @@ func NewRouter(
func (r *Router) Init() *chi.Mux {
router := chi.NewRouter()
router.Use(CORSMiddleware)
router.Get("/", r.rootController.Index)
router.Get("/software", r.softwareController.Index)