Forum Discussion
MeAndMyBIGIP_60
Nimbostratus
Jun 21, 2010HTTP::URI redirect to another Pool
Trying to use the sample code here (http://devcentral.f5.com/wiki/default.aspx/iRules/HTTP__uri.html) to do something that should be very simple: when HTTP_REQUEST {
if { [HTTP::uri] ends...
Michael_Yates
Nimbostratus
Jun 21, 2010What your wanting can be done several ways.
result is a request to HTTP://x.x.x.5" target="_blank" rel="nofollow">HTTP://x.x.x.5 gets switched to HTTPS:// and routed to either Node 1 or Node 2 based on least connections.
A Simple HTTP to HTTPS Redirect can be done using the iRule below (Placed this iRule on your Port 80 Virtual Server). The Routing to Node1 or Node2 won't happen because what your doing is a full 302 Redirect from HTTP to HTTPS.
when HTTP_REQUEST {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
This iRule can be placed on either your Port 80 or 443 Virtual Server. When applied to your Port 80 Virtual Server it will 302 Redirect to your Port 443 Virtual Server (again, no node specification because it is a redirect). When applied to your Port 443 Virtual Server, it will override the Virtual Server Pool Setting and send traffic to a specified Server Pool.
when HTTP_REQUEST {
if {[TCP::local_port] == 80 } {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
elseif {[TCP::local_port] == 443 } {
pool Content_Pool_1
}
}
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