Put an application in maintenance mode
Show a maintenance page to every visitor while you change the application, keep your own access open, and return to normal by removing one rule.
You put an application in maintenance mode with a request-phase rule on its rules engine. The rule answers every visitor with a maintenance page and ends the request before it reaches the origin. Removing the rule returns the application to normal, with no deploy. To change what visitors see when the origin itself returns an error, refer to Custom Pages.
Prerequisites
- An application on Azion, bound to a workload.
- A maintenance page reachable by URL: a page on another site, or an object in an Object Storage bucket served by its own connector.
- Your public IP address, to keep your own access open.
Redirect every visitor to the maintenance page
To send visitors to a page hosted elsewhere:
Access Azion Console > Applications > your application > Rules Engine tab.
Enter a Name, for example maintenance, and select Request Phase.
In Criteria, set If ${uri} starts with /, so the rule matches every request.
In Behaviors, select Redirect To (302 Found) and enter the URL of the maintenance page. The 302 tells browsers and search engines that the move is temporary.
Every request to the application now answers with a 302 to the maintenance page, and nothing reaches the origin.
Serve the maintenance page from your own domain
To keep visitors on your domain, serve the page from an Object Storage bucket instead of redirecting. Rewrite Request requires Application Accelerator on the application.
For the steps, refer to Upload and download objects.
In Connectors, create a connector of type Object Storage that points at the bucket.
Access Azion Console > Applications > your application > Rules Engine tab.
Select Add Rule, select Request Phase, and set If ${uri} starts with / in Criteria.
In Behaviors, add Set Connector with the storage connector, then Rewrite Request with /maintenance.html.
Every request answers with the maintenance page from the bucket, under your own domain.
Keep your own access open
To keep working on the application while visitors see the maintenance page, exclude your address from the rule:
Access Azion Console > Applications > your application > Rules Engine tab, and select the rule.
In Criteria, add and ${remote_addr} is not equal your public IP address.
Requests from your address reach the application as usual. Every other request still gets the maintenance page.
End the maintenance
To return the application to normal, delete the maintenance rule. The remaining rules keep working as before.