Docs
Skip to content

Firewall

Redirect a site for maintenance_

Create Appwrite Firewall rules that send visitors of a site to a maintenance page and back.

2 min read

Raw

A redirect rule sends matching visitors to another location. Use it to put a deployed site into maintenance without a new deployment.

This guide uses two rules on one site. A bypass rule keeps the maintenance page itself reachable. A redirect rule sends every other path to the maintenance page. Without the bypass rule, requests to the maintenance page would match the redirect rule and loop.

Create the bypass rule

  1. Open Firewall in your project.
  2. Click Create rule.
  3. Enter a Rule name (for example Allow maintenance page).
  4. Set Resource type to Sites and select your site.
  5. Under conditions, set Path Equals /maintenance.
  6. Under Then, choose Bypass.
  7. Set Priority to 10.
  8. Click Create rule.

Create the redirect rule

Create firewall rule wizard with redirect settings
Create firewall rule wizard with redirect settings

  1. Click Create rule again.
  2. Enter a Rule name (for example Redirect to maintenance page).
  3. Set Resource type to Sites and select the same site.
  4. Under conditions, set Path Starts with /.
  5. Under Then, choose Redirect.
  6. Set Redirect location to /maintenance.
  7. Keep Status code at 302.
  8. Set Priority to 100.
  9. Click Create rule.

Use 302 so browsers and search engines do not cache the redirect.

Verify the rules

  1. Open any path of the site in a browser. Confirm the browser lands on /maintenance.
  2. Open /maintenance directly. Confirm that the page loads without a redirect and renders with its styles.
  3. Open Firewall and confirm the Redirected series rises in the traffic overview.

End the maintenance

  1. Open Firewall and select the site in the resource selector.
  2. Turn off the status toggle of the redirect rule.

The site serves normal traffic again. Keep the disabled rule for the next maintenance window, or delete it.

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.