Forum Discussion
URL rewrite through iRule
- Nov 11, 2013
Hi Sunnyman,
This will work;
if { [IP::addr [IP::client_addr] equals 1.1.1.1] || [IP::addr [IP::client_addr] equals 1.1.1.2} { SNAT with 1.1.1.100 snatpool VM_SNAT_POOL_1_1_1_100 } elseif { [IP::addr [IP::client_addr] equals 1.1.1.11] || [IP::addr [IP::client_addr] equals 1.1.1.12} { SNAT with 1.1.1.100 snatpool VM_SNAT_POOL_1_1_1_200 }
But that's not a very scalable way of doing it if your list is going to grow. If it's going to grow then use an address datagroup, with values snatpool names, which you can use like this
snatpool [class match -value [IP::remote_addr] equals dg_sunnyman_snatpools]
or more correctly;
set snatpool [class match -value [IP::remote_addr] equals dg_sunnyman_snatpools] if {$snatpool ne "") { snatpool $snatpool }
Hi Joanna, i checked your last solution, it worked well for some VSs on my load-balancer, but i countered to one another small issue: do you know how can i change only the Context part of a URL? for example, when clinets want to see "www.abc.com/photos?tid5335gfgf53..." , in addition of URL-rewrite, i want to change the context part (fisrt part) of related URI (e.g. to "www.xyz.com/gallery?tid5335gfgf53..."). So, i don't want to change last part of URI (parameters). I want only to change first part of URI (in my example, "photos" to "gallery" with the same parameters as first URI). can you help me again joanna? thanks a lot for your regards...
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