Forum Discussion
Lance_Simon_557
May 03, 2007Historic F5 Account
redirect iRule to different uri
have a vip on port 80
pool members on port 50100
need to have this come to the vip
http://sapxpq.browning.k12.ia.us
and redirect it to
http://sapxpq.browning.k12.ia.us:50100/irj/portal
what is the simplest way of accomplishing this?
Thanks
3 Replies
- JRahm
Admin
This will do what you are asking:when HTTP_REQUEST { if { ([HTTP::host] eq "sapxpq.browning.k12.ia.us") and [HTTP::uri] < 2 } { HTTP::redirect "http://sapxpq.browning.k12.ia.us:50100/irj/portal" } }
However, is this really what you want? You will need a virtual listening on port 50100 as well, or the virtual setup originally will have to listen on port 0 so that port 80 and port 50100 can be accomodated.
The LTM will do the port redirection for you, so if that is your concern, you could just redirect them to http://sapxpq.browning.k12.ia.us/irj/portal and the requests will look like this:
Hitting LTM:
http://sapxpq.browning.k12.ia.us:80/irj/portal
Hitting Server:
http://server_IP:50100/irj/portal
HTH....Jason - Kevin_Stewart
Employee
Try this:
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
if { $uri equals "/" } {
pool somepool_50100_pool
HTTP::redirect "/irj/portal"
}
}
Kevin - Deb_Allen_18Historic F5 AccountHey Lance --
Both rules take the right approach for the simple redirect you requsted, but since HTTP/1.1 requires an absolute redirect, I'd recommend citizen_elah's post with one modification:
Change
to[HTTP::uri]
to test whether the URI is longer than "/".[string length [HTTP::uri]]
(And I agree that the customer may not yet have given you a complete and accurate description of his requirements...)
HTH
/deb
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