Forum Discussion
Vishal_96707
Nimbostratus
Jan 21, 2009iRule for Response Header "content-length"
I need help with getting the "content-length" value in Response header. Basically the iRule should check for HTTP "Status" 404 and "content-length" not equal to zero.
Thanks in a...
hoolio
Cirrostratus
Jan 22, 2009You can get the Content-Length header value using 'HTTP::header value "Content-Length"'. Note that if the server responds with chunked encoding there wouldn't be a Content-Length header and [HTTP::header value "Content-Length"] would return a null length string.
when HTTP_RESPONSE {
Check if response code is a 404 and the Content-Length header value is 0
if {[HTTP::status] == 404 && [HTTP::header value "Content-Length"] == 0}{
Do something?
log local0. "[IP::client_addr]:[TCP::client_port]: Found 404 response with 0 Content-Length"
}
}
Aaron
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