Grig_Larson_167
Aug 20, 2014Nimbostratus
Need to redirect URI to URI (or URL to URL) in an iRule for hosted URL to an unhosted server
I am sure this is a something super simple, but I am not entering in the right search terms. I am fairly new to the F5, but experienced in Linux.
We host dozens of servers with different hosts and URIs. Management wants to centralize all redirects on the F5 for better track of what's getting redirected where. So far, we have done this successfully with domains (hosts) to URI's:
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
if { $host contains "2014floorplan.example.com"} {
HTTP::redirect "http://expocad.example.com/vendors2014/ec/forms/attendee/indexTab.aspx"
} elseif { $host contains "fubar.example.com"} {
HTTP::redirect "http://community.shrm.org/fubar/support/"
}
This works. But what if I wanted to take a web URL/URI like: anyone who goes to **www.example.com/email** gets redirected to **www.thirdpartysite.com/mailform?customer=example_assoc&ID=8675309**
I have tried many things based on many forum posts and devcentral, but I am sure I am not searching for the right terms. Here's what I am currently trying (and it's not working)
``when HTTP_REQUEST {
set location [string tolower [HTTP::uri]]
switch -glob [HTTP::uri] {
"www.shrm.org/email" { HTTP::respond 301 Location "http://thirdparty.com/abc/" }
}
}
I am sure this can be done, but I am not understanding the syntax.
Also, is there a way to make the URL look like www.example.com/email/ so the user does not know they are in another third party site?