Skip to content

Add dedicated maintenance mode page instead of generic error #257

Description

@Antoni-Czaplicki

Summary

When the backend is in maintenance mode, it returns 503 Service unavailable. The frontend currently treats this like any other error — showing a generic "Błąd podczas ładowania quizu" (quiz loading error) page. We should detect the 503 and display a proper, user-friendly maintenance page instead.

Current behavior

When maintenance mode is active, the backend middleware (maintenance/middleware.py) returns:

  • 503 with JSON body {"detail": "Service is unavailable"} (for Content-Type: text/plain requests)
  • 503 with plain text "Service unavailable" (for other requests)

The frontend doesn't distinguish this from other errors and shows the generic error page with a misleading message about the quiz not existing or connection problems (see screenshot below).

What the user sees now:
Image

This is confusing — the quiz exists, the backend is just temporarily down for maintenance.

Expected behavior

When any API call returns a 503 status code, the frontend should:

  1. Show a dedicated maintenance page/overlay with a clear message, e.g.:
    • "Testownik jest w trakcie przerwy technicznej" / "Testownik is undergoing maintenance"
    • "Wrócimy wkrótce!" / "We'll be back soon!"
  2. Not show error-specific UI like "quiz not found" or "try logging in"
  3. Optionally auto-retry — poll the backend every ~30s and automatically reload when it comes back (the backend lets /api/login/ through even during maintenance, so a lightweight health-check could use that)
  4. Apply globally — this should be handled at the HTTP client interceptor level, not per-page, since any route can trigger it

Design suggestions

  • A simple centered page with an illustration/icon (wrench, construction, etc.)
  • The app header can remain visible
  • Should feel intentional and calm, not like something broke

Backend context

The maintenance mode is toggled via django-constance (config.MAINTENANCE_MODE). The following paths are exempt and always work:

  • /api/admin/
  • /api/login/
  • /api/authorize/

Staff/superuser users are also exempt (they get normal responses even during maintenance).

Metadata

Metadata

Assignees

Labels

Type

Fields

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions