Forum Discussion
Any way to cache HEAD request
I'm not sending any significant header data. A HTTP HEAD method request is sent to see if the page has changed & typically has content length & a few other headers, but for just the headers to be returned - the servers have to go through the normal GET method. So the only saving in the whole process is the network traffic of the body not being returned to the requestor. That is why it would be beneficial for the f5 to cache it just like a GET method.
- PauliusJan 06, 2026
MVP
This might work for your purpose but I haven't tested it before so you might consider doing it in a lab or dev environment.
when HTTP_REQUEST { # Check if the request method is HEAD if { [HTTP::method] eq "HEAD" } { # Check if we have a cached response for this request if { [cache lookup -key [HTTP::uri]] ne "" } { # Serve the cached response HTTP::respond 200 content [cache lookup -key [HTTP::uri]] } else { # Cache the response for future HEAD requests (optional) # Continue processing the request and cache the response if applicable cache add -key [HTTP::uri] -value [HTTP::response] # Proceed with the original request forward } } else { # If the method is not HEAD, forward the request normally forward } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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