Disable CORS
Signed-off-by: Arzumify <jliwin98@danwin1210.de>
This commit is contained in:
parent
5492212611
commit
b1e06cf673
|
@ -344,6 +344,18 @@ func Main(information library.ServiceInitializationInformation) *chi.Mux {
|
||||||
// Set up the router
|
// Set up the router
|
||||||
router := chi.NewRouter()
|
router := chi.NewRouter()
|
||||||
|
|
||||||
|
// Add the CORS middleware
|
||||||
|
disableCors := func(next http.Handler) http.Handler {
|
||||||
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
next.ServeHTTP(w, r)
|
||||||
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||||
|
w.Header().Set("Access-Control-Allow-Headers", "*")
|
||||||
|
w.Header().Set("Access-Control-Allow-Methods", "*")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
router.Use(disableCors)
|
||||||
|
|
||||||
// Set up the static routes
|
// Set up the static routes
|
||||||
staticDir, err := fs.Sub(information.ResourceDir, "static")
|
staticDir, err := fs.Sub(information.ResourceDir, "static")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue