Forum Discussion
Dave_22257
Nimbostratus
Oct 25, 2011URL Redirect
I need to create an irule to redirect certain URI strings to a specific pool on my F5 device. Sound simple enough but I am having issues writing the irule to match the specific URI's. The u...
nitass
Employee
Oct 25, 2011[root@iris:Active] config b virtual bar list
bvirtual bar {
translate service enable
snat automap
pool foo
destination 172.28.17.33:any
ip protocol tcp
rules myrule
profiles {
http {}
tcp {}
}
}
[root@iris:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if {[HTTP::host] contains "xyz.net.au"} {
switch [getfield [HTTP::host] ":" 2] {
"8181" {
log local0. "8181"
}
"8443" {
log local0. "8443"
}
default {
log local0. "default"
}
}
}
}
}
[root@iris:Active] config curl -I http://xyz.net.au/
HTTP/1.1 200 OK
Date: Mon, 24 Oct 2011 22:14:17 GMT
Server: Apache/2.0.59 (rPath)
Last-Modified: Sat, 11 Jun 2011 00:31:47 GMT
ETag: "667a-67-cfb682c0"
Accept-Ranges: bytes
Content-Length: 103
Vary: Accept-Encoding
Set-Cookie: testcookie=helloworld
Content-Type: text/html; charset=UTF-8
Oct 25 15:04:03 local/tmm info tmm[4672]: Rule myrule : default
[root@iris:Active] config
[root@iris:Active] config curl -I http://xyz.net.au:8181/
HTTP/1.1 200 OK
Date: Mon, 24 Oct 2011 22:14:32 GMT
Server: Apache/2.0.59 (rPath)
Last-Modified: Sat, 11 Jun 2011 00:31:47 GMT
ETag: "667a-67-cfb682c0"
Accept-Ranges: bytes
Content-Length: 103
Vary: Accept-Encoding
Set-Cookie: testcookie=helloworld
Content-Type: text/html; charset=UTF-8
Oct 25 15:04:17 local/tmm info tmm[4672]: Rule myrule : 8181
[root@iris:Active] config curl -I http://xyz.net.au:8443/
HTTP/1.1 200 OK
Date: Mon, 24 Oct 2011 22:14:45 GMT
Server: Apache/2.0.59 (rPath)
Last-Modified: Sat, 11 Jun 2011 00:31:47 GMT
ETag: "667a-67-cfb682c0"
Accept-Ranges: bytes
Content-Length: 103
Vary: Accept-Encoding
Set-Cookie: testcookie=helloworld
Content-Type: text/html; charset=UTF-8
Oct 25 15:04:30 local/tmm info tmm[4672]: Rule myrule : 8443
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