()
| 281 | } |
| 282 | |
| 283 | func (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 | |
| 305 | func (l *Location) AddServerCache(cacheKey string, serverCacheTime int, serverCacheUint string) { |
| 306 | l.UpdateDirective("proxy_ignore_headers", []string{"Set-Cookie", "Cache-Control", "expires"}) |
no test coverage detected