Forum Discussion
murphs76_64953
Nimbostratus
Apr 28, 2014Mobile redirect iRule :uri "/groupon" to m.site.com/19550
Hello Network Engineers asked to be overnight developers :),
I am asked to write a redirect iRule.
Here is what I came up with -->
when HTTP_REQUEST {
if { [string tolower [HTTP::u...
nitass
Employee
Apr 29, 2014I don't think it will work in this situation.
why not?
e.g.
config
[root@ve11a:Active:In Sync] config tmsh list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
profiles {
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
vs-index 9
}
[root@ve11a:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
if { [class match -- [string tolower [HTTP::path]] starts_with redirect_class] } {
HTTP::redirect "http://[class match -value [string tolower [HTTP::path]] starts_with redirect_class]"
}
}
}
[root@ve11a:Active:In Sync] config tmsh list ltm data-group internal redirect_class
ltm data-group internal redirect_class {
records {
/groupon {
data m.site.com/1231
}
/hilton {
data m.site.com/1233
}
/shoprunner {
data m.site.com/1232
}
}
type string
}
test
[root@ve11a:Active:In Sync] config curl -I http://site.com/groupon/something
HTTP/1.0 302 Found
Location: http://m.site.com/1231
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve11a:Active:In Sync] config curl -I http://site.com/shoprunner/something
HTTP/1.0 302 Found
Location: http://m.site.com/1232
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve11a:Active:In Sync] config curl -I http://site.com/hilton/something
HTTP/1.0 302 Found
Location: http://m.site.com/1233
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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