Fix cors
This commit is contained in:
18
src/main.go
18
src/main.go
@@ -11,6 +11,8 @@ import (
|
||||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -44,6 +46,22 @@ func main() {
|
||||
router := gin.Default()
|
||||
corsConfig := cors.DefaultConfig()
|
||||
corsConfig.AllowOrigins = []string{"https://sheets.julian-mutter.de"}
|
||||
corsConfig.AllowHeaders = []string{
|
||||
"Origin",
|
||||
"X-Requested-With",
|
||||
"Content-Type",
|
||||
"Accept",
|
||||
"Authorization",
|
||||
}
|
||||
corsConfig.AllowMethods = []string{
|
||||
http.MethodHead,
|
||||
http.MethodGet,
|
||||
http.MethodPost,
|
||||
http.MethodPut,
|
||||
http.MethodPatch,
|
||||
http.MethodDelete,
|
||||
}
|
||||
corsConfig.AllowCredentials = true
|
||||
|
||||
router.Use(cors.New(corsConfig))
|
||||
routes.SetupRoutes(router)
|
||||
|
||||
Reference in New Issue
Block a user