# F5 Maintenance Page

**URL:** <https://community.f5.com/t/f5-maintenance-page/74281>\
**Category:** Technical Forums\
**Tags:** devops\
**Created:** [April 1, 2024, 1:54pm UTC](https://community.f5.com/t/f5-maintenance-page/74281 "2024-04-01T13:54:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![igor\_1](https://avatars.discourse-cdn.com/v4/letter/i/f07891/32.png) [@igor\_1](https://community.f5.com/u/igor_1)\
**Post date:** [April 1, 2024, 1:54pm UTC](https://community.f5.com/t/f5-maintenance-page/74281/1 "2024-04-01T13:54:57Z")

</div>

Hi,

We are trying to set up a maintenance page in case of 503 error code, but it doesn’t matter which code is received by the client it always gets a maintenance page, even if the code is 200 OK.

We are using this iRule"

```auto
when HTTP_REQUEST {
  HTTP::respond 503 content {
<HTML>
     <head>
        <title>Maintenance Page</title>
    </head>
    <body>
    <style>
    body {
    background-image: url("https://www.somesite.com/download/503.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    }
    </style>
 </body>
</html> "Content-Type" "text/html" "Retry-After" "3600" "Connection" "Close"
 }
}

```

Thanks,

Igor

---

<div class="post-metadata">

**Author:** ![Paulius](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/paulius/32/21698_2.png) [@Paulius](https://community.f5.com/u/Paulius)\
**Post date:** [April 1, 2024, 10:24pm UTC](https://community.f5.com/t/f5-maintenance-page/74281/2 "2024-04-01T22:24:38Z")

</div>

@igor_1 The reason for this is because the event you are defining is when and HTTP request comes in from the outside the F5 responds with the 503. If your intent is to tie this to some servers that are currently down you would need to do the following if you have a default pool associated to the virtual server.

```tcl
when CLIENT_ACCEPTED priority 500 {

   set DEFAULT_POOL [LB::server pool]

}

when HTTP_REQUEST priority 500 {

    if { [active_members [${DEFAULT_POOL}]] == 0 }{
        HTTP::respond 503 content {
            <HTML>
            <head>
            <title>Maintenance Page</title>
            </head>
            <body>
            <style>
            body {
                background-image: url("https://www.somesite.com/download/503.png");
                background-size: contain;
                background-repeat: no-repeat;
                background-attachment: fixed;
                background-position: center;
                height: 100vh;
                width: 100vw;
                overflow: hidden;
            }
            </style>
            </body>
            </html> "Content-Type" "text/html" "Retry-After" "3600" "Connection" "Close"
        }
    }

}

```

---

<div class="post-metadata">

**Author:** ![Joseph\_Martin](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/joseph_martin/32/24017_2.png) [@Joseph\_Martin](https://community.f5.com/u/Joseph_Martin)\
**Post date:** [April 1, 2024, 10:29pm UTC](https://community.f5.com/t/f5-maintenance-page/74281/3 "2024-04-01T22:29:43Z")

</div>

Igor,

The iRule command HTTP::respond is a command, not a condition.&nbsp; You said that you want to respond with a maintenance page **IF** the response from the server is 503.&nbsp; So you need to include that condition in your iRule.&nbsp; Also, that condition, the server response code, cannot be known until we get a response form the server, so you will need to use the HTTP\_RESPONSE event instead of the HTTP\_REQUEST event.&nbsp; Finally, the server response code is accessible via the HTTP::status iRule command  
It will look something like this:

```tcl
when HTTP_RESPONSE {
  if { [HTTP::status] eq "503" } {
    HTTP::respond 503 content { 
      your response content
      goes here
    }
  }
}

```

Hope that helps,

JM
