Change CORS to Cors on CLI options, specify origins as an option
This commit is contained in:
@@ -80,7 +80,7 @@ func serveResult(result interface{}, err error, c *gin.Context) {
|
||||
func corsMiddleware() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
c.Header("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
|
||||
c.Header("Access-Control-Allow-Origin", "*")
|
||||
c.Header("Access-Control-Expose-Headers", "*")
|
||||
c.Header("Access-Control-Allow-Origin", command.Opts.CorsOrigin)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ func SetupMiddlewares(group *gin.RouterGroup) {
|
||||
group.Use(requestInspectMiddleware())
|
||||
}
|
||||
|
||||
if command.Opts.CORS {
|
||||
if command.Opts.Cors {
|
||||
group.Use(corsMiddleware())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user