Rewrite http:// to https:// in response content
Problem this snippet solves: (Maybe I missed it, but) I didn't see a code share for using a STREAM profile to rewrite content from http to https.
This share is just to make it easier to find a...
Updated Jun 06, 2023
Version 2.0Michael_Jenkins
Cirrostratus
Joined May 21, 2019
Yiğit_Uslu
Aug 22, 2021Cirrus
Hi Paul,
The stream expression is applied to allot compressed mime-types including png. You need to exclude them.
if { [HTTP::header Content-Type] contains "text" } {
STREAM::expression {@http:\/\/@@}
# enable STREAM
STREAM::enable
} elseif { ([HTTP::header Content-Type] contains "png") or ([HTTP::header Content-Type] contains "msword") or ([HTTP::header Content-Type] contains "ms-excel") or ([HTTP::header Content-Type] contains "ms-powerpoint") or ([HTTP::header Content-Type] contains "pdf") or ([HTTP::header Content-Type] contains "application/x-shockwave-flash") or ([HTTP::header Content-Type] contains "svg")} {
# disable STREAM
STREAM::disable
}