Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

Redirect to a Maintenance page

My F5 should redirect all the incoming traffic like HTTP,HTTPS etc to a maintenance page without disabling all the virtual or back-end servers Any idea ? Please

0
Rate this Discussion

Replies to this Discussion

placeholder+image

Hi!

I can give you two options:

Use content on the site. Maintenance content would be places in /maintenance/ in this example, and Office_public_IPs is a data group list containing the office IPs (so you can browse the site from the office while it's in maintenance for the rest of the world):

    when HTTP_REQUEST {
    # When the site needs to go into maintenance mode we enable this iRule.
    # It should redirect all requests to the maintenance page (unless already there)
    if { [matchclass [IP::client_addr] equals Office_public_IPs] } {
        # do nothing. Offices is allowed 
    } elseif { [string tolower [HTTP::path]] starts_with "/maintenance/" }{
        # Do nothing. This is a valid path
    } else {
        HTTP::uri "/maintenance/default.aspx"
    }
}

Or serve the content directly from the load balancer.

when HTTP_REQUEST {
    # When the site needs to go into maintenance mode we enable this iRule.
    # It should redirect all requests to the maintenance page (unless already there)
    if { [matchclass [IP::client_addr] equals Office_public_IPs] } {
        # do nothing. Offices is allowed 
    } elseif { [string tolower [HTTP::path]] starts_with "/maintenance/" }{
        # Do nothing. This is a valid path
    } else {
        set blocked 1
        HTTP::respond 200 content {
              
                 
                    Apology Page
                 
                 
                    We are sorry, but the site you are looking for is temporarily out of service due to maintenance.
                    It will be back up shortly.
                 
              
        }
    }
}

Please note for example two you will have to enclose your following iRules that selects pools or redirects with this (otherwise it will send clients resets instead):

if { [info exists blocked] && $blocked == 1 } {
    #Put irule content here
}

Good luck!

/Patrik

0
Comments on this Reply
Comment made 15-Mar-2014 by PSPK 269
Can you give me an example please, for suppose if any user visits www.abc.com or www.guest.abc.com it should redirect to the URL "http://sorry.efgh.com/system_down.html"
0
placeholder+image

Looks like devcentral is parsing out HTML code.

Try inserting this into rule number two (the one with all the whitespace) and replace "[" with "<" and "]" with "/>":

[html]
 [head]
    [title]Apology Page[/title]
 [/head]
 [body]
    We are sorry, but the site you are looking for is temporarily out of service due to maintenance.
    It will be back up shortly.
 [/body]
  [/html]

/Patrik

0
placeholder+image

And a third option would be the Fallback host in the HTTP profile. You can specify the page you want to redirect users to there. But they would not be able to load the site by refreshing the browser page.

/Patrik

0
placeholder+image

Can you give me an example please, for suppose if any user visits www.abc.com or www.guest.abc.com it should redirect to the URL "http://sorry.efgh.com/system_down.html"

Ok, if you want a redirect, I'd go for the third option:

  1. Go to Local Traffic -> Profiles -> Services -> HTTP Profiles
  2. Create a new one.
  3. Click the checkbox in the "Fallback host" row and enter "http://sorry.efgh.com/system_down.html" as the value.
  4. Save the HTTP profile.
  5. Assign it to the virtual server.

Then you should be all set if all the pools are down.

Good luck!

/Patrik

0
placeholder+image

@Patrik Jonsson

Thanks for your time and help

0
Comments on this Reply
Comment made 21-Mar-2014 by Patrik Jonsson 3524
No problem!
0
Comment made 03-Jan-2018 by Frank 270

Hi Patrik, I know it is an old post but hopefully, you can help. I am trying to host a maintenance page on f5 itself using iFiles but I have been told that I have to do SSL bridging as I am using HTTP profile with the iRule to trigger the maintenance page via iFiles. The problem is our business require traffic to be end to end encrypted for that I am using performanceL4 and after that I am not able to host maintenence page on f5 using iFiles as if I use http profile with perfomanceL4 then it breaks the connection. Is there a way that can be used to host a maintenence page on f5 using iFile. Or the second option we can use an external portal and redirect all packets to that portal without doing SSL bridging. ???

0
Comment made 05-Jan-2018 by Patrik Jonsson 3524

Sorry, I don't understand your question. Please elaborate?

/Patrik

0
placeholder+image

As i know,http profile is mandatory to host Ifiles.

Thx

Srini

0
placeholder+image

If I understand you correctly you're not allowed to terminate traffic on the F5 at all? In that case I don't see a way for you to host the page with iFiles.

What you could do is to try something like this:

when LB_FAILED {
    pool sorry_pool
}

Just make sure that the servers in the sorry_pool adds a "Connection: close" header or users will end up staying on the sorry pages.

/Patrik

0