Forum Discussion
dyobbs_25515
Feb 03, 2012Nimbostratus
iRule to redirect a variable to http
Guys hi,
I'm newbie here. I wanted to create an iRule, that truncates the later part of the message from the "http://.acme.com" to http://
any help is appreciated.
Will t...
nitass
Feb 09, 2012Employee
please feel free to revise.
[root@ve1023:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
set newhost [string map {".acme.com.nz" ""} $host]
if {$host ne $newhost} {
HTTP::redirect "http://$newhost[HTTP::uri]"
}
}
}
[root@ve1023:Active] config curl -I http://172.28.19.79/whatever -H "Host: xxxx.acme.com.nz"
HTTP/1.0 302 Found
Location: http://xxxx/whatever
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config curl -I http://172.28.19.79/whatever -H "Host: www.yahoo.com.acme.com.nz"
HTTP/1.0 302 Found
Location: http://www.yahoo.com/whatever
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config curl -I http://172.28.19.79/whatever -H "Host: www.yahoo.com.au.acme.com.nz"
HTTP/1.0 302 Found
Location: http://www.yahoo.com.au/whatever
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
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