add cors check and update docker file
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
func CORS() gin.HandlerFunc {
|
||||
return gin.HandlerFunc(func(c *gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
c.Header("Access-Control-Allow-Origin", "*")
|
||||
c.Header("Access-Control-Allow-Credentials", "true")
|
||||
c.Header("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With")
|
||||
@@ -17,5 +17,5 @@ func CORS() gin.HandlerFunc {
|
||||
}
|
||||
|
||||
c.Next()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,11 +101,11 @@ func (r *Router) Init() *gin.Engine {
|
||||
engine := gin.New()
|
||||
engine.Use(
|
||||
middleware.JsonAPI(),
|
||||
middleware.CORS(),
|
||||
middleware.CorrelationID(),
|
||||
middleware.Recover(),
|
||||
middleware.HTTPStatLogger(),
|
||||
middleware.PopulateContext(),
|
||||
middleware.CORS(),
|
||||
)
|
||||
|
||||
r.addAppRoutes(engine)
|
||||
|
||||
Reference in New Issue
Block a user