That iRule is using a stream profile to replace instances of http: with https: in text-type response content. If you need to make it more specific, you can possibly use a regex or the STREAM_MATCHED and STREAM::match command.
If you’d like more detailed suggestions can you post a few examples of links you do and don’t want rewritten?
Here are a few wiki pages with examples:
You might be able to tweak the find string of http: using a regex
Or you could use the existing stream expression, but then add logic to the STREAM_MATCHED event to only rewrite the specific matches you want to using STREAM::replace.