> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sevalla.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These are the docs for Sevalla, a platform for deploying applications, databases, static sites, object storage and load balancers. The dashboard is at https://app.sevalla.com.
> Bold text in steps is an exact dashboard label.
> To act on a Sevalla account, prefer the Sevalla MCP server (https://mcp.sevalla.com/mcp, see https://docs.sevalla.com/ai-agents/overview.md), then the Sevalla CLI (https://docs.sevalla.com/developer-tools/cli.md), then the REST API (https://api-docs.sevalla.com, OpenAPI spec at https://api.sevalla.com/v3/openapi.json).
> Every page index is at https://docs.sevalla.com/llms.txt.

# Maintenance mode

> Serve a maintenance page with status 503 on every domain of an application while it keeps running, use your own page, and turn it on or off from the dashboard or the API.

Maintenance mode serves a maintenance page to every visitor of an application instead of the application itself. The application keeps running, its workers and cron jobs keep working, and you can still deploy, so you can run a database migration or a risky release without visitors reaching a half-updated app. Maintenance mode is available for applications only, not for static sites.

## What visitors get

While maintenance mode is on, Sevalla answers every request at Cloudflare's edge. No request reaches your application.

| What | Value |
| - | - |
| Status code | `503 Service Unavailable` |
| `Retry-After` header | `300` (seconds) |
| `Cache-Control` header | `no-store` |
| `Content-Type` header | `text/html; charset=utf-8` |
| Body | The default page, or the content of your [custom page](#use-a-custom-maintenance-page) |
| Domains | Every domain of the application: its `sevalla.app` domain and every custom domain |
| Paths and methods | Every path and every method, including `POST` and API calls |
| Exceptions | None. There's no bypass by IP address, header, cookie or path, including for your own traffic. |

The default page has the title "Maintenance in progress", the heading "This app is undergoing maintenance" and no branding, and it reloads itself every 30 seconds, so visitors get the application back without refreshing once you turn maintenance mode off.

Because the response comes from the edge, the application's own responses, redirects and CORS headers aren't sent either. A browser making cross-origin calls to the application gets the `503` without CORS headers.

### How maintenance mode works with other features

| Feature | While maintenance mode is on |
| - | - |
| [IP restrictions](/applications/networking#ip-restrictions) | Still apply first. A blocked IP address gets `403 Forbidden`, not the maintenance page. An allowed IP address gets the maintenance page. |
| HTTP to HTTPS redirect | Still applies first: an `http://` request gets the `301` to `https://`, then the maintenance page. |
| [Hibernation](/applications/scaling#hibernation) | Requests don't wake a hibernated application. The first request after you turn maintenance mode off wakes it as usual. |
| [CDN and edge caching](/applications/caching) | Cached responses aren't served and nothing is cached. Turning maintenance mode on or off doesn't purge the cache, so responses cached before maintenance can be served again afterwards. |
| [Deployments](/applications/deployments) | Work as usual. Maintenance mode stays on after a deployment until you turn it off. |
| Workers, cron jobs and jobs | Keep running: only HTTP traffic to the web process is replaced. |

## Turn on maintenance mode

<Info>
  You need permission to update the application.
</Info>

<Steps>
  <Step title="Open the application's settings">
    In the sidebar, click **Applications**, then click the application. Click the **Settings** tab.
  </Step>

  <Step title="Open maintenance mode">
    In the **Maintenance mode** section, click **Update maintenance mode**.
  </Step>

  <Step title="Turn it on">
    Turn on **Enable maintenance mode**. To show your own page instead of the default one, enter its URL in **Maintenance page URL** (see [Use a custom maintenance page](#use-a-custom-maintenance-page)).
  </Step>

  <Step title="Save">
    Click **Update maintenance mode**.
  </Step>
</Steps>

The **Maintenance mode** section's **Status** changes to **Enabled**, and **Maintenance page** shows your page's URL if you set one. Cloudflare locations can take up to a minute to apply the change. Open the application's domain in a private window to check that it shows the maintenance page.

## Use a custom maintenance page

Instead of the default page, Sevalla can serve the content of any HTTPS page you host, for example a free [static site](/static-sites/overview) on Sevalla. Visitors stay on your application's domain: Sevalla fetches the page and serves its HTML with the same `503` status and headers.

| Rule | Detail |
| - | - |
| URL | Starts with `https://`, a valid URL of at most 2048 characters |
| What's used | Only the page's HTML. Its own status code and headers, such as `Set-Cookie`, aren't passed on. |
| Relative links | Work: Sevalla adds a `<base>` tag that points at the page's URL, so images, styles and scripts load from the page's host. |
| Fonts and requests the page makes | Need CORS enabled on the page's host, because the browser loads them from another domain. |
| Updates | Sevalla caches the page for 60 seconds in each Cloudflare location, so edits to the page show within 60 seconds. |
| Failures | If the page returns an error or can't be reached, visitors get the default page. |
| Where to host it | A static site or any host outside Sevalla. Don't point the URL at another Sevalla application. |

To prepare a page in advance, enter its URL with **Enable maintenance mode** off and save. Sevalla keeps the URL and uses it the next time you turn maintenance mode on. To go back to the default page, clear **Maintenance page URL** and save.

## Turn off maintenance mode

<Steps>
  <Step title="Open maintenance mode">
    On the application's **Settings** tab, in the **Maintenance mode** section, click **Update maintenance mode**.
  </Step>

  <Step title="Turn it off">
    Turn off **Enable maintenance mode**, then click **Update maintenance mode**.
  </Step>
</Steps>

The **Status** changes to **Disabled**, and within a minute every Cloudflare location sends requests to the application again. The saved page URL stays for next time.

## API and CLI

| Task | API | CLI |
| - | - | - |
| Check maintenance mode | [Get maintenance mode](https://api-docs.sevalla.com/v3/applications/get-maintenance-mode) | Not available |
| Turn maintenance mode on or off, set the page URL | [Update maintenance mode](https://api-docs.sevalla.com/v3/applications/update-maintenance-mode) | Not available |

The update operation replaces the whole setting: send `is_enabled` and `page_url` together. If you leave out `page_url` or send `null`, Sevalla clears the saved URL and serves the default page. An empty string is rejected.

```bash theme={null}
curl -X PUT https://api.sevalla.com/v3/applications/$APP_ID/maintenance-mode \
  -H "Authorization: Bearer $SEVALLA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"is_enabled": true, "page_url": "https://maintenance.example.com"}'
```

Replace `$APP_ID` with the application's ID (on its **Settings** tab, under **Details**) and `$SEVALLA_API_KEY` with an [API key](/developer-tools/api-keys) that can update the application.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.