mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
4.0.0-beta.0
This commit is contained in:
parent
91c3ad7fd8
commit
a4d324a361
38 changed files with 497 additions and 1428 deletions
|
|
@ -1,17 +1,15 @@
|
|||
package nocache
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/infinite-iroha/touka"
|
||||
)
|
||||
|
||||
func NoCacheMiddleware() app.HandlerFunc {
|
||||
return func(ctx context.Context, c *app.RequestContext) {
|
||||
func NoCacheMiddleware() touka.HandlerFunc {
|
||||
return func(c *touka.Context) {
|
||||
// 设置禁止缓存的响应头
|
||||
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) // 继续处理请求
|
||||
c.SetHeader("Cache-Control", "no-store, no-cache, must-revalidate")
|
||||
c.SetHeader("Pragma", "no-cache")
|
||||
c.SetHeader("Expires", "0")
|
||||
c.Next() // 继续处理请求
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue