Forum Discussion
Ardie_6003
Jan 13, 2011Nimbostratus
Need help on HTTP Redirection
Hi,
I'm new to the F5. Need some expert advise on this.
I have 2 url.
a) www.x.x
b) mobile.x.x
Both shared the same servers, virtual servers & public IP (don't know if this is advisable). The only difference is www using port 80 while mobile port 84 for example.
I have create
1. Pools
2. Virtual Server
Should I create an iRules for this? I want when users hit mobile, it redirect to port 84.
I've copy from somewhere..
when HTTP_REQUEST {
set my_uri [string tolower [HTTP::uri]]
if { $my_uri starts_with "/mobile.x/" } {
HTTP::redirect "http://mobile.x.x"
}
}
Is this rules correct? Or is there any additional rules I have to create? How to points this Rules to Virtual Server or Pools?
Please advise on this. Thanks.
- JRahmAdminassuming you have two pools, one for www with members defined with port 80, the other for mobile with members defined with port 84, you can do something like this:
when HTTP_REQUEST { if { [getfield [string tolower [HTTP::host]] "." 1] eq "www" } { pool www_pool } elseif { [getfield [string tolower [HTTP::host]] "." 1] eq "mobile" } { pool mobile_pool } else { pool default } }
- JRahmAdminof course, this assumes you are on v9 or newer. I assume this is the case even though the post is in the v4 forum. If you need v4, I'll have to check, it's been over six years since I've touched it.
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