add Access-Control-Max-Age by OPTIONS (#9257)
Update serve.go 避免每次请求都发送预检请求。 对于 OceanPress 这类工具而言,能够获得更快的速度
This commit is contained in:
parent
bb59ed97e5
commit
3c2f4e50e1
1 changed files with 1 additions and 0 deletions
|
@ -530,6 +530,7 @@ func corsMiddleware() gin.HandlerFunc {
|
|||
c.Header("Access-Control-Allow-Private-Network", "true")
|
||||
|
||||
if c.Request.Method == "OPTIONS" {
|
||||
c.Header("Access-Control-Max-Age", 600)
|
||||
c.AbortWithStatus(204)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue