HTTP 503 Service Unavailable


The HTTP 503 Service Unavailable status code indicates that the server is not ready to handle the request. Common causes include the server being down for maintenance, overloading, or experiencing temporary issues.


The HTTP 503 response is used to inform the client that the server is currently unable to handle the request and that the condition is likely to be temporary.


Client Behavior:

  1. Send Request: The client sends an HTTP request to the server.
  2. Receive Response: The client receives an HTTP 503 status code, indicating service unavailability.

Server Behavior:

  1. Unavailable Condition: The server is currently unable to handle the request.
  2. Send Response: The server sends a 503 Service Unavailable response to the client.


  • Server Maintenance: When the server is undergoing maintenance and is temporarily unavailable.
  • Overloaded Server: The server is currently overloaded and unable to handle additional requests.

Sequence Diagram

Illustrating the process for an HTTP 503 response:

    participant Client
    participant Server

    Note over Client: Step 1: Client sends a request
    Client->>Server: GET /resource HTTP/1.1 (Step 1)

    Note over Server: Step 2: Server is currently unavailable
    Server-->>Client: HTTP/1.1 503 Service Unavailable (Step 2)

Curl Request and Response Example

Sending a request using Curl to a server that is currently unavailable:

curl -i
# Expected response: HTTP/1.1 503 Service Unavailable

PHP cURL Request and Response Example

PHP script using cURL to handle a 503 Service Unavailable response:

$ch = curl_init('');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 503) {
    echo "Service Unavailable";

Python Request and Response Example

Python script sending a request to a server that is currently unavailable and handling a 503 Service Unavailable response:

import requests
response = requests.get('')
if response.status_code == 503:
    print("Service Unavailable")

Apache Configuration for HTTP 503 Service Unavailable

Configuring Apache to handle 503 errors:

# Apache Configuration Example
ErrorDocument 503 "Service Unavailable"

NGINX Configuration for HTTP 503 Service Unavailable

NGINX configuration for handling 503 errors:

# NGINX Configuration Example
error_page 503 /503.html;
location = /503.html {
    return 503 "Service Unavailable";

HTTP 502 Bad Gateway HTTP 504 Gateway Timeout


Free Weekly


Join my weekly newsletter for the latest in tech! You'll get neat coding tricks, trend updates, career advice, SaaS reviews, crypto, bitcoin, and financial tips. All straight to your inbox, designed to keep you ahead.