Forum Discussion
scarpozzi_82104
Nimbostratus
Dec 09, 2010Redirection when clients are at /
I've got a portal server that will be unavailable weekly due to some oracle cold backups. I've got an iRule that sets up the maintenance window and gives me controls to automate the recurring window.
My portal server listens on 80/443 in 2 pools/virtual servers. When the database goes down for backups, I have Apache spin up another instance listening on port 81 for the maintenace page...so I created a maintenance pool.
To handle requests during the maintenace window, the command I have is:
use pool maint_pool
I tested this and it works great. The problem is, when a user is logged into the portal and it goes down for maintenance, they get a 404 because the pool switches out from under them. I need a redirect for established connections and the 'use pool maint_pool' for new connections.
To get what I want, I'm going to need a redirect when the maintenance window is on and the HOST:URI doesn't match portal.site.com. What iRule functions allow you to compare the client URL and do a redirect when it isn't 'portal.site.com' or 'portal.site.com/'
Thanks.
- hoolio
Cirrostratus
An HTTP client cannot send a null URI. Something like this should do:when HTTP_REQUEST { Check for anything not portal.site.com/ if {"[string tolower [HTTP::host]][HTTP::uri]" eq "portal.site.com/"}{ pool maint_pool } else { HTTP::redirect "http://portal.site.com/" } }
when HTTP_REQUEST { Check for host of portal.site.com if {[string tolower [HTTP::host]] eq "portal.site.com"}{ Check if URI is a maintenance URI switch -glob [HTTP::uri] { "/maint/*" - "/maintenance.jpg" - "/maintenance.css" - "/maintenance.html" { pool maint_pool return } } } If we're still in the iRule, the request wasn't for a maintenance URI, so redirect the request HTTP::redirect "http://portal.site.com/" }
- scarpozzi_82104
Nimbostratus
Thank you so much!
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