Forum Discussion
Ram_63318
Nimbostratus
Jun 10, 2008HTTP to HTTPS Redirection
1.) When customers goes directly to
http://vipnation.com/livenation/php/eventslist.php load balancer is not redirecting to https://vipnation.com/livenation/php/login.php
Redirection works for the following though:
www.vipnation.com
vipnation.com
http://vipnation.com
https://vipnation.com
iRule being used for this customer is as follows:
when HTTP_REQUEST {
if { ! ([string tolower [HTTP::uri]] starts_with "/livenation/") } {
HTTP::redirect "https://vipnation.com/livenation/php/login.php"
}
}
Are there anything that I could do to the above iRule so that it would work as expected?
Thank you,
Ram
- Andy_Herrman_22
Nimbostratus
What exactly do you want it to doWhat exactly do you want it to do? When do you want the redirect to happen? - Ram_63318
Nimbostratus
Basically when customer goes to http://vipnation.com/livenation/php/eventslist.php load balancer should redirect to https://vipnation.com/livenation/php/login.php also like it does for the following: - hoolio
Cirrostratus
It looks like you have the concept down of how to evaluate the requested URI and send a redirect to the client. Now it's just a matter of deciding what logic to use in implementing the iRules. If you aren't sure of what you need, try what you have and add logging statements to track what's happening when it doesn't work. As it looks like you might being using two different rules on the two VIPs make sure to note which VIP the request is being made to in the logs.when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: new request on [TCP::local_port] to [HTTP::host][HTTP::uri]" if { ! ([string tolower [HTTP::uri]] starts_with "/livenation/") } { log local0. "[IP::client_addr]:[TCP::client_port]: redirecting https://vipnation.com/livenation/php/login.php" HTTP::redirect "https://vipnation.com/livenation/php/login.php" } }
- Ram_63318
Nimbostratus
Hoolio, - Deb_Allen_18Historic F5 AccountHi Ram -
if { ! ([string tolower [HTTP::uri]] starts_with "/livenation/") } { HTTP::redirect "https://vipnation.com/livenation/php/login.php" }
when HTTP_REQUEST { if { [HTTP::uri] equals "/") } { HTTP::redirect "https://vipnation.com/livenation/php/login.php" } }
- Ram_63318
Nimbostratus
Deb, - hoolio
Cirrostratus
If you want to redirect requests to http://vipnation.com/ and https://vipnation.com/ and http://vipnation.com/livenation/php/eventslist.php to the login page you can use Deb's last example and add a check if the port is 80 and the requested URI is /livenation/php/eventslist.php. If you don't care whether the port is 80 and always want to redirect /livenation/php/eventslist.php to the login page, then remove '([TCP::local_port]==80 and' from the 'if' statement.when HTTP_REQUEST { if { [HTTP::uri] equals "/" or ([TCP::local_port]==80 and [HTTP::uri] eq "/livenation/php/eventslist.php"} { HTTP::redirect "https://vipnation.com/livenation/php/login.php" } }
- Andy_Herrman_22
Nimbostratus
I'm guessing he wants to redirect all non-SSL traffic to the login page over SSL, AND all paths that aren't in /livenation/ to the login page (so, only requests to https://.../livenation/* would be allowed through).when HTTP_REQUEST { if { (! ([string tolower [HTTP::uri]] starts_with "/livenation/")) or ([TCP::local_port]==80) } { HTTP::redirect "https://vipnation.com/livenation/php/login.php" } }
- zafer
Nimbostratus
how can i redirect client request for only login page,
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