I’m trying to write an iRule with a regexp that will scour outgoing HTTP payloads and replace http with https and remove any port (and the colon preceeding the port number) - that is, scrub all outgoing urls (like http://www.example.com:8080/) and replace them with https://www.example.com/.
If you know what ports are referenced in the HTTP content you might be able to use a stream profile to perform the replacement using fewer resources than buffering the response data and doing a regsub.
Here is an example:
when HTTP_RESPONSE {
STREAM::enable
STREAM::expression @http://www.example.com:80@http://www.example.com@@https://www.example.com:443@https://www.example.com@
}
The format for the stream expression is @search1@replace1@@search2@replace2@@
See the wiki page for stream (Click here) and this post for more info (Click here).