mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
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")
|
c.Header("Access-Control-Allow-Private-Network", "true")
|
||||||
|
|
||||||
if c.Request.Method == "OPTIONS" {
|
if c.Request.Method == "OPTIONS" {
|
||||||
|
c.Header("Access-Control-Max-Age", 600)
|
||||||
c.AbortWithStatus(204)
|
c.AbortWithStatus(204)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue