Forum Discussion
URI Rewrite remove info
- Jan 07, 2020
Hi Curious,
Can you try this iRule?
when HTTP_REQUEST { if { [string match {/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*} [HTTP::uri]] } { # log local0. "matchedUri: [HTTP::uri]" set changedUri [string trimleft [HTTP::uri] "/"] # log local0. "changedUri: $changedUri" if { $changedUri contains "/"} { set newUri "[string range $changedUri [string first / $changedUri] end]" } else { set newUri "/" } # log local0. "newUri: $newUri" HTTP::redirect "http://[HTTP::host]$newUri" } }
You can change regex with better expression. I couldn't find exact expression for the IP match.
string tcl can look for exact strings, it doesn't act as a regex. The Op is asking for any IP address, not a particular IP address. Would this be still possible ?
Hey, any further help available on this as it has me beat?
The URLs will change in length as there will be different IP's that need to be removed. No pool will be assigned to the VS and the IP shown in the URL will be used to select a target to connect to. The IP in the URL needs to be removed as this URL will be invalid when requesting the resource on the target.
eg1. hxxp://abc.com/10.4.5.100/path/file (remove the IP and keep anything else)
eg2. hxxp://abc.com/10.50.100.200/path/file
Any assistance will be really appreciated.
Recent Discussions
Related Content
* 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