MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / AddBroswerNoCache

Method AddBroswerNoCache

agent/utils/nginx/components/location.go:283–303  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

281}
282
283func (l *Location) AddBroswerNoCache() {
284 l.RemoveDirective("add_header", []string{"Cache-Control", "no-cache"})
285 l.RemoveDirectiveByFullParams("if", []string{"(", "$uri", "~*", `"\.(gif|png|jpg|css|js|woff|woff2)$"`, ")"})
286 l.RemoveDirectiveByFullParams("if", []string{"(", "$uri", "~*", `"\.(gif|png|jpg|css|js|woff|woff2|jpeg|svg|webp|avif)$"`, ")"})
287 directives := l.GetDirectives()
288 newDir := &Directive{
289 Name: "if",
290 Parameters: []string{"(", "$uri", "~*", `"\.(gif|png|jpg|css|js|woff|woff2|jpeg|svg|webp|avif)$"`, ")"},
291 Block: &Block{},
292 }
293 block := &Block{}
294 block.Directives = append(block.Directives, &Directive{
295 Name: "add_header",
296 Parameters: []string{"Cache-Control", "no-cache"},
297 })
298 newDir.Block = block
299 directives = append(directives, newDir)
300 l.Directives = directives
301 l.CacheTime = -1
302 l.CacheUint = "s"
303}
304
305func (l *Location) AddServerCache(cacheKey string, serverCacheTime int, serverCacheUint string) {
306 l.UpdateDirective("proxy_ignore_headers", []string{"Set-Cookie", "Cache-Control", "expires"})

Callers 1

OperateProxyMethod · 0.95

Calls 3

RemoveDirectiveMethod · 0.95
GetDirectivesMethod · 0.95

Tested by

no test coverage detected