F5 HTTP 缓存 相关

根据官放参数说明Include List 包含需要缓存的uri 路径,但是实际的测试中没有缓存任何内容,根据

The cache feature does not cache the following items:

Data specified by the following Cache-Control headers: private, no-store
Note: Specifying no-cache in the Cache-Control header does not mean that the resource is not cached. It indicates that the stored response must always go through validation with the origin server first before using it. To not store the response in any cache, no-store is used.
Action-oriented HTTP methods such as HEAD, PUT, DELETE, TRACE, and CONNECT
Cache-Control headers: private, no-store ,但是no-cache 通常是可以缓存的,需要每次查询是否过期在这里不缓存。
所以需要在Pin List 或者Include Override List 定义。
Include List  缓存可能和 RFC 2616 的规范有关系 ,只能允许
Cache-Control: public,max-age=2592000
  • Include List - Configures a list of URIs to cache and determines if a request should be evaluated normally according to RFC2616 caching rules. The default value is .*, which specifies that all URIs are cacheable.
 鉴于上述问题直接 irules 解决 需要挂载相关 profile
when HTTP_REQUEST {
    log local0. "http_method::[HTTP::method]"
    if {[HTTP::method] == "GET"} {
        # [   HTTP::uri] end
        set uriadd [string tolower [HTTP::path]]
        log local0. "path [HTTP::uri]"
        switch [getfield $uriadd  "." 2] {
        "js" -
        "pdf" -
        "css" -
        "jpg" -
        "png" {
                # enable the cache
                CACHE::enable
            log local0. "URI::[HTTP::uri]"
            }
            default {
                #disable the cache
                CACHE::disable
        }

}
}
}
 

缓存官方配置

https://support.f5.com/csp/article/K14903

参数说明

https://techdocs.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm-profiles-reference-13-1-0/2.html

正则实例

https://support.f5.com/csp/article/K41250435


The recommended filters are as follows :

 
Extension to MatchRegex query
   
js files .*\.js
.png, .jpg, .jpeg, .gif files .*\.png, .*\.jpg, .*\.jpeg, .*\.gif
htm/html files .*\.htm, .*\.html
png images named logo .*logo\.png
js files including query string parameters .*\.js.*
jquery.js with any query string parameters .*jquery\.js.*

老化率描述

https://support.f5.com/csp/article/K14333

原文地址:https://www.cnblogs.com/zy09/p/15669294.html