copy and fix cors

This commit is contained in:
YouROK
2021-10-04 15:51:09 +03:00
parent 689d98bad3
commit 0262beba56
4 changed files with 401 additions and 2 deletions

View File

@@ -3,11 +3,12 @@ package web
import (
"net"
"github.com/gin-contrib/cors"
"github.com/gin-contrib/location"
"github.com/gin-gonic/gin"
"server/dlna"
"server/settings"
"server/web/cors"
"server/web/msx"
"server/log"
@@ -39,7 +40,9 @@ func Start(port string) {
corsCfg := cors.DefaultConfig()
corsCfg.AllowAllOrigins = true
corsCfg.AllowHeaders = []string{"Origin", "Content-Length", "Content-Type", "X-Requested-With", "Accept", "Authorization"}
corsCfg.AllowHeaders = []string{"*"}
corsCfg.AllowMethods = []string{"*"}
corsCfg.AllowPrivateNetwork = true
route := gin.New()
route.Use(log.WebLogger(), blocker.Blocker(), gin.Recovery(), cors.New(corsCfg), location.Default())