Forum Discussion
Scott_Larson
Nimbostratus
Aug 17, 2007Regexp to scrub http response data payload
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/.
I've got this so far:
set find "http(s)*(://www.example.com)(:[0-9]+)*"
but when I try to save my iRule, I get:
[undefined procedure: 0-9] [0-9]
Can anyone help me please?
- Scott_Larson
Nimbostratus
ha, I just found my own answer, thanks to the SSN scrubbing example. I'll use \d to denote a number rather than [0-9]. My new regexp is:set find "http(s)*(://www.example.com)(\d)+)*"
- hoolio
Cirrostratus
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.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@ }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects