Skip to content

Commit

Permalink
🐛 Add Access-Control-Allow-Credentials to header
Browse files Browse the repository at this point in the history
  • Loading branch information
soxft committed Aug 16, 2024
1 parent c50dd8b commit bf8e45a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/middleware/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ func Cors() gin.HandlerFunc {
}

c.Header("Server", "busuanzi-by-xcsoft/"+config.VERSION)

if c.Request.Method == "OPTIONS" {
c.Header("Access-Control-Allow-Methods", "GET, POST, HEAD, OPTIONS")
c.Header("Access-Control-Allow-Headers", "x-bsz-referer, Authorization")
c.Header("Access-Control-Allow-Credentials", "true")
c.Header("Access-Control-Max-Age", "86400")
c.AbortWithStatus(204)
return
Expand Down

0 comments on commit bf8e45a

Please sign in to comment.