Forum Discussion
Wil_Schultz_101
Nimbostratus
Jan 26, 2007Possible to insert header in CACHE_RESPONSE?
I would like to insert a header on cache response so I will quickly know if a page was served from the origin server of from cache. I'm attempting the following:
when CACHE_RESPONSE {
if { [HTTP::uri] contains "/" } {
HTTP::header insert "Via" "Cache"
log local.cachedresponse
}
}And am receiving the following error:
tmm tmm[1025]: 01220001:3: TCL error: Rule testirule - Out of bounds (line 2) invoked from within "HTTP::header insert Via: BigIP"5 Replies
- bl0ndie_127134Historic F5 AccountYou can but you will have to get version 9.4; sorry.
On the other hand, you could add the header in HTTP_RESPONSE before it gets cached. If the header value does not change between requests, this would be a preferable method because you will only do this once. - Wil_Schultz_101
Nimbostratus
So I've tested with the following:when HTTP_RESPONSE { HTTP::header insert "Server" "Cache" }
This does indeed add the header, however it keeps it there whether the response has been previously cached or not. In an ideal world it would be grand to not have the header there if the request was not a cached response, - bl0ndie_127134Historic F5 AccountI agree that's a bit of a pia. Are you making the caching decision in HTTP_REQUEST? A lot of folks use data groups to call CACHE::enable of CACHE::disable command to manually enable/disable the cache. If you are also doing that, you could just set a variable as a hint whether or not to add the header on the response. Other wise you will have to get 9.4.
- rb1980_75708
Nimbostratus
so how do you do it in 9.4? - bl0ndie_127134Historic F5 AccountTry CACHE::header insert
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
