Forum Discussion
TalNe
Nimbostratus
Sep 20, 2016How to get the response size after gzip compression
Hi,
i have virtual server that run HTTP Compression Profile
i need to get the size of the response packet after the gzip compression before it leave the f5 machine
i try the fallow irule
...
Kai_Wilke
MVP
Sep 21, 2016Hi Talne,
if the responce content is not
chunked, then you may use the Content-Length header value of the HTTP_RESPONSE_RELEASE event. Below is a simple iRule which analyses the Content-Length during HTTP_RESPONSE and HTTP_RESPONSE_RELEASE event and then performs rocket science to output the compression ratio...
when HTTP_REQUEST {
set http_path [HTTP::path]
}
when HTTP_RESPONSE {
set content_l [HTTP::header value "Content-Length"]
}
when HTTP_RESPONSE_RELEASE {
if { ( [HTTP::header value "Content-Length"] ne "" ) and ( $content_l ne [HTTP::header value "Content-Length"] ) } then {
log local0.debug "Path: $http_path Comperssion Ratio: [expr { [HTTP::header value "Content-Length"] / ( $content_l / 100 ) }]%"
}
}
Note: If you need to analyse the compression ratio of chunked content, then you could experiment with a VIP-targeting-VIP setup where the serverside VIP compresses the content and the clientside VIP analyses the transmited payload of the serverside VIP.
Cheers, Kai
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
