mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
[break] change auth config & add auth key
This commit is contained in:
parent
978ece6fa0
commit
395f641468
8 changed files with 50 additions and 27 deletions
17
middleware/nocache/nocache.go
Normal file
17
middleware/nocache/nocache.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package nocache
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
)
|
||||
|
||||
func NoCacheMiddleware() app.HandlerFunc {
|
||||
return func(ctx context.Context, c *app.RequestContext) {
|
||||
// 设置禁止缓存的响应头
|
||||
c.Response.Header.Set("Cache-Control", "no-store, no-cache, must-revalidate")
|
||||
c.Response.Header.Set("Pragma", "no-cache")
|
||||
c.Response.Header.Set("Expires", "0")
|
||||
c.Next(ctx) // 继续处理请求
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue