Technical

503 Service Unavailable

The 503 Service Unavailable HTTP status code indicates the server is temporarily unable to handle the request, typically due to maintenance or overload, and that the situation is expected to be temporary.

503 is the correct status code for planned maintenance or temporary outages. Unlike 5xx errors that may signal reliability issues, a properly implemented 503 with a `Retry-After` header tells search engines to come back later without penalizing your rankings.

Critical distinction: if your site returns 5xx errors for extended periods, Google may reduce crawl rate and eventually deindex pages. A 503 with `Retry-After` explicitly communicates that the outage is planned and temporary. Google will respect the retry window and maintain your current index state.

In Next.js middleware, return a 503 during maintenance windows. Include a `Retry-After` header with either a number of seconds or an HTTP date indicating when the service will be available again. Serve a user-friendly maintenance page with the 503 status.

Example

// Next.js Middleware — maintenance mode with 503
import { NextResponse } from "next/server";

export function middleware() {
  if (process.env.MAINTENANCE_MODE === "true") {
    return new NextResponse(
      "<html><body><h1>Maintenance in progress</h1></body></html>",
      {
        status: 503,
        headers: {
          "Content-Type": "text/html",
          "Retry-After": "3600", // Come back in 1 hour
        },
      }
    );
  }
}

Stop shipping broken SEO

Indxel validates your metadata, guards your CI/CD pipeline, and monitors indexation — so you never miss an SEO issue again.