Lior_Cohen_2771
Aug 31, 2017Nimbostratus
iRule to modify Cache-Control Header
Hi I want to create an iRule to modify the cache control to private when sending the HTTP Respond
the cache control is public so my cache system before the F5 can cache to contanet, but i dont want any other cache system after the F5 cache we content
I try this code
when HTTP_RESPONSE {
HTTP::header insert X-Cache "MISS F5-IG"
if {[string length [HTTP::header "Cache-Control"]]} {
set new_cache [string map -nocase {"public" "private"} [HTTP::header "Cache-Control"]]
HTTP::header replace Cache-Control $new_cache
}
}
when CACHE_RESPONSE {
CACHE::header replace X-Cache "HIT F5-IG"
if {[string length [CACHE::header "Cache-Control"]]} {
set new_cache1 [string map -nocase {"public" "private"} [CACHE::header "Cache-Control"]]
CACHE::header replace Cache-Control $new_cache1
}
}
but when i apply the iRule the system F5 won use RAM_CACHE anymore (can't get CACHE_RESPONSE),
i can change to code make the change only when CACHE_RESPONSE, but this resolve in Cache-Control public when page Age is 0