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 this work?
when HTTP_REQUEST {
if { [HTTP::uri] starts_with ".acme.com" } {
HTTP::redirect "http://[HTTP::host]"
}
- nitassEmployee
can you post the question again? some text is missing because of devcentral's parser.
- dyobbs_25515NimbostratusHi thanks!
- dyobbs_25515NimbostratusNitass hi,
- nitassEmployeecan you map "xxxx.acme.com.nz" and "xxxx" to same ip address which is virtual server address in local hosts file on client?
- dyobbs_25515NimbostratusNitass hi,
- nitassEmployeeplease 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
- dyobbs_25515NimbostratusThanks Nitass! but somehow only works on Google Chrome.
- nitassEmployeeIE and firefox, does not redirect.
- dyobbs_25515NimbostratusCool stuff, now i can monitor. Works now. Thanks Nitass!
- Kalpesh_48932NimbostratusHello...I have one problem for setting up an iRule (i m new for iRule)
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