Skip to content

Commit

Permalink
fix: apiserver cors error
Browse files Browse the repository at this point in the history
  • Loading branch information
0xff-dev committed Mar 20, 2024
1 parent 6e64f1d commit 39ca07d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apiserver/service/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import (
func Cors() gin.HandlerFunc {
return func(c *gin.Context) {
method := c.Request.Method
c.Header("Access-Control-Allow-Origin", "*")
origin := c.GetHeader("origin")
c.Header("Access-Control-Allow-Origin", origin)
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
c.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization, namespace, Referer, User-Agent")
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type")
Expand Down

0 comments on commit 39ca07d

Please sign in to comment.