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, Thanks again, certainly your solution is fine in related scenarios, but yet there is one small issue: as i mentioned before, i want to change the url to "1.1.1.1:8080/xyz", meanwhile there is no URL on 1.1.1.1. In fact, the new URL that i want to rewrite or to use is "1.1.1.1:8080/xyz". So, i don't want to use "partner.abc.com" in new Host header, i just want to send traffic to new node pool 1.1.1.1:8080 , but at the end of this address the "/xyz" URI should be inserted and makes "1.1.1.1:8080/xyz".Do you have any other idea about this issue?
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