enable compression if parameter exists in content type

Newbie here. I’m trying to compress data with content type “text/html;charset=UTF-8”. I do not want to compress the data if the parameter is missing i.e content type “text/html” should not be compressed but “text/html;charset=UTF-8” should.

I’ve tried using the following rule but without success.

when HTTP_RESPONSE {

set content_type [string tolower [HTTP::header Content-Type]]

if { $content_type contains “text/html;charset=UTF-8”}{

COMPRESS::enable

}

}

change UTF in your if statement to utf since you are converting the content type information to lowercase.

Thanks for the responses…

The following rule worked.

when HTTP_RESPONSE {

if { [HTTP::header Content-Type] contains “charset”} {

COMPRESS::enable

}

}

Neither “text/html;charset=UTF-8” nor “charset=UTF-8” worked.

Are “;” and “=” considered as special characters that need to be escaped?