Forum Discussion
thagmann_128177
Nimbostratus
Mar 25, 2005Compression iRules - GZIP vs. Deflate Preference
F5 DevCentral,
Hi, our understanding is that when doing a Profile that utilizes Compression that BIGIP will prefer the Deflate vs. GZIP method. We would like to have a rule that utilizes GZIP by default.
The current rule we are using to do this is:
===================================
b rule force_gzip '{ when HTTP_RESPONSE { [COMPRESS::method prefer gzip] }}'
which gives us
[rootxxxxxxx:Active] config b rule list
rule force_gzip {
when HTTP_RESPONSE { [COMPRESS::method prefer gzip] }
}
When we then associate this rule with a VIP we get an error.
ERROR in /var/log/ltm
===================================
Mar 25 22:31:03 tmm tmm[702]: 01220001:3: TCL error: Rule force_gzip - invalid command name "" while executing "[COMPRESS:
:method prefer gzip]"
Do you have any ideas what we might be doing wrong?
Thanks,
-t
- bl0ndie_127134Historic F5 Account
b rule force_gzip '{ when HTTP_RESPONSE { COMPRESS::method prefer gzip ;event disable }}'
- bl0ndie beat me to it (and finally when I knew an answer to an iRule question!)
- thagmann_128177
Nimbostratus
Thanks guys that took and my compression stats are now incrementing. - thagmann_128177
Nimbostratus
Doh, I spoke too soon. So my rule took and my Connections are being compressed but when I look at Traces the content-encoding is still set as deflate vs. GZIP. - thagmann_128177
Nimbostratus
Still no love. My Traces still show Deflate in the CONTENT-ENCODING Header.... - bl0ndie_127134Historic F5 AccountMr -t, looks like you have found a problem with the Deflate filter. We will try to se what we can do to get this fixed asap, but in the mean time can you give this rule a whirl.
rule gzip { when HTTP_RESPONSE { COMPRESS::method prefer gzip event disable } when HTTP_REQUEST { if {[HTTP::header exist "Accept-Encoding"]} { HTTP::header replace "Accept-Encoding" "gzip" event disable } } }
- thagmann_128177
Nimbostratus
Ok, this workaround seems to work and my CONTENT-ENCODING Headers are now properly showing as GZIP. Getting this fixed soon would be great and since you guys usually GUI-ify any rule that gets alot of use, you should probably add this GZIP vs. DEFALTE Rule to the HTTP Profile in 9.0. - drteeth_127330Historic F5 Account1) Yes. Inserting a header is more expensive than changing some internal state in compression processing. UnRulely recently posted some information about enabling rule timing metrics which could help determine how much more expensive. However, the best way is always to benchmark it.
- thagmann_128177
Nimbostratus
So based on all of the changes we talked about, I just want to double-check that I now have the right rule rule that removes the original rule + does the GZIP check in the ACCEPT-ENCODING Header. - bl0ndie_127134Historic F5 AccountYou are very close. The header 'exist' command does not check the header value, it works only on the name. Lets scan the value for 'gzip' and convert it if one found.
rule gzip { when HTTP_REQUEST { if {[string first "gzip" [HTTP::header "Accept-Encoding"]] != -1} { HTTP::header replace "Accept-Encoding" "gzip" } } }
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