mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
15 lines
352 B
Go
15 lines
352 B
Go
package nocache
|
|
|
|
import (
|
|
"github.com/infinite-iroha/touka"
|
|
)
|
|
|
|
func NoCacheMiddleware() touka.HandlerFunc {
|
|
return func(c *touka.Context) {
|
|
// 设置禁止缓存的响应头
|
|
c.SetHeader("Cache-Control", "no-store, no-cache, must-revalidate")
|
|
c.SetHeader("Pragma", "no-cache")
|
|
c.SetHeader("Expires", "0")
|
|
c.Next() // 继续处理请求
|
|
}
|
|
}
|