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 05, 2023
Version 2.0Michael_Jenkins
Cirrostratus
Joined May 20, 2019
Emil
Altocumulus
Aug 25, 2022Just wanted to update. My final version to work in our environment is :
when HTTP_REQUEST {
STREAM::disable
}
when HTTP_RESPONSE {
if { [HTTP::header Content-Type] contains "text" } {
STREAM::expression {@http://@https://@}
STREAM::enable
}
elseif { ([HTTP::header Content-Type] contains "png") or ([HTTP::header Content-Type] contains "jpeg") or ([HTTP::header Content-Type] contains "application/x-font-woff") or ([HTTP::header Content-Type] contains "pdf") or ([HTTP::header Content-Type] contains "svg") or ([HTTP::header Content-Type] contains "image/svg+xml")} {
STREAM::disable
}
}Not sure about the application/x-font-woff content. Probably it is unnecessary and will remove it.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)