Manual Chapter : Example: Using selective compression

Applies To:

Show Versions Show Versions

BIG-IP PEM

  • 15.0.1, 15.0.0

BIG-IP ASM

  • 15.0.1, 15.0.0

BIG-IP LTM

  • 15.0.1, 15.0.0
Manual Chapter

Example: Using selective compression

You can create a local traffic policy to support selective compression for types of content that can benefit from compression. For example, common text types (HTML, XML, and CSS style sheets) can realize performance improvements, especially across slow connections, if you compress them.

Examples

Creating a policy to support selective compression: video example

You can associate a BIG-IP local traffic policy with a virtual server to support selective compression for types of content that can benefit from compression. For example, common text types (HTML, XML, and CSS style sheets) can realize performance improvements, especially across slow connections, if you compress them. Watch the following video for an example of creating a local traffic policy and associating it with a virtual server.
You can also visit our DevCentral YouTube channel to see this video. Use any of these ways:
  • Copy and paste the above URL into your browser window.
  • Use your browser to search for this video using the title
    F5: Using Selective Compression
    .

Selective compression: tmsh example

This topic provides a
tmsh
command to list the configured settings for a Selective Compression policy, for types of content that can benefit from compression. For example, common text types (HTML, XML, and CSS style sheets) can realize performance improvements, especially across slow connections. This topic also provides a
tmsh
command to list the configured virtual server settings.
(tmos)# list ltm policy SelectiveCompression ltm policy SelectiveCompression{ controls { compression } description "This policy compresses specified file types." last-modified 2016-03-02:11:46:00 requires { http } rules { CompressFiles { actions { 0 { compress response enable } } conditions { 0 { http-header name Content-Type starts-with values { text/ } } 1 { cpu-usage last-1min less-or-equal values {5} } } } } status published strategy first-match } (tmos.ltm.virtual)# list ltm virtual HTTP-VS2 ltm.virtual.HTTP-VS2{ destination 10.10.0.31:http ip-protocol tcp mask 255.255.255.255 policies { SelectCompression { } } profiles { http { } httpcompression { } tcp { } } source 0.0.0.0/0 translate-address enabled translate-port enabled vs-index 3 }

Selective compression: iRules example

This topic provides an example of iRules code that is equivalent to a policy to support selective compression for types of content that can benefit from compression.
when HTTP_REQUEST { COMPRESS::disable if { [HTTP::header Content-Type] contains "text" } { log "Enabling compression for this request" COMPRESS::enable } }