Articles

How to put checkout in maintenance mode without taking your website offline

Pause a single checkout route with 503 and Retry-After, keep pricing and robots.txt online, and reopen without redeploying.

Updated

To put only checkout in maintenance mode, return HTTP 503 with Retry-After on the checkout route and leave the rest of the website online. On Gregale, a hostname-and-path edge rule can do that without a code change or a redeploy. Your customers can still browse pricing and docs while you work on checkout.

Download the runnable example

1. Decide what needs to pause

Start with the smallest scope. This demo pauses exactly /checkout while /pricing and /robots.txt keep serving. It uses no payment provider and does not process orders.

On a real app, the checkout page, order submission API, and any background jobs may be separate. Inventory every entry point that must stop accepting new orders, and test its path and method. A browser page alone might not block a client calling the API directly. An edge rule does not stop work already in flight, cancel a worker, or prevent an external service from charging a customer. Handle those separately if your maintenance needs it.

Google recommends limiting functionality instead of taking the entire site down for a temporary interruption. Keep normal pages and robots.txt reachable rather than replacing them with a maintenance response, a 404, or a noindex tag. See Google Search Central’s temporary-closure guidance.

2. Add an expiring edge rule

From the example directory, deploy once with the Gregale CLI. Use a fresh test app.

bash
APP='replace-with-a-new-demo-app'
gregale deploy --name "$APP" --source=worktree
HOST='replace-with-the-host-printed-by-deploy'
gregale --json release traffic status "$APP"

Record the serving deployment UUID. Before changing anything, make sure /checkout, /pricing, and /robots.txt all return 200. Then add the maintenance edge rule:

bash
gregale edge rule create --app "$APP" --kind maintenance \
  --match-host "$HOST" --match-path /checkout \
  --maintenance-retry-after-seconds 120 \
  --maintenance-message 'Checkout is briefly paused. Please try again in 2 minutes.' \
  --expires-in 10m

Save the returned rule ID. The rule matches the named hostname. If the same checkout is reachable through a second hostname or another route, plan for that address explicitly. Retry-After: 120 is a hint to retry in 120 seconds, not the timespan of the rule or a promise that checkout is back at that time. The expiration is a separate backstop; choose it deliberately, especially if reopening early would be unsafe.

3. Verify the pause, then reopen checkout

Request all three paths. Use the application's usual request authorization if the test app is private.

bash
curl -sS -D - -o /dev/null "https://$HOST/checkout"
curl -sS -D - -o /dev/null "https://$HOST/pricing"
curl -sS -D - -o /dev/null "https://$HOST/robots.txt"

Checkout should return 503 with Retry-After: 120. The other two should still return 200. This edge rule sends a problem response with the configured message; it does not replace your page with a styled HTML screen. If your store needs one, build that experience separately and keep the temporary HTTP status correct.

When it's safe to reopen, remove only the rule you created:

bash
gregale edge rule delete RULE_ID --app "$APP"
curl -sS -D - -o /dev/null "https://$HOST/checkout"
gregale --json release traffic status "$APP"

Confirm checkout is back to 200, the other paths still work, and the serving deployment UUID hasn't changed.

Hosted test results

On one disposable private Gregale app on Scale, authenticated GETs returned:

PathBeforeDuring maintenanceAfter removing the rule
/checkout200503, Retry-After: 120200
/pricing200200, unchanged body200, unchanged body
/robots.txt200200, unchanged body200, unchanged body

The same deployment UUID stayed at 100% traffic throughout. We removed the rule deliberately and verified checkout recovered. We did not test expiration by waiting, a payment workflow, anonymous ingress, or indexing.

For deployment-related changes rather than a short operational pause, see how to verify the release serving production.

Questions

Can I enable maintenance mode for just one website route?

Yes. Scope a maintenance edge rule to the exact hostname and path you need to pause. Gregale sends HTTP 503 with Retry-After for matching requests while other routes continue normally.

Does Retry-After determine when checkout reopens?

No. Retry-After advises clients when to retry. Rule expiration or removing the rule controls when requests reach checkout again.

Does pausing the checkout page stop orders already in progress?

No. The rule applies to new matching HTTP requests. Order APIs, queued work and payments already in progress need their own safeguards.