HTTP

HTTP 406 Not Acceptable vs 503 Service Unavailable

HTTP 406 (Not Acceptable) is a 4xx Client Error response, while 503 (Service Unavailable) is a 5xx Server Error response. 406 indicates that the server cannot produce a response matching the Accept headers sent by the client. In contrast, 503 means that the server is temporarily unable to handle the request due to maintenance or overload. Should include a Retry-After header.

Description

The server cannot produce a response matching the Accept headers sent by the client.

When You See It

When requesting a content type the server doesn't support (e.g., Accept: application/xml when only JSON is available).

How to Fix

Adjust the Accept header to a format the server supports.

Description

The server is temporarily unable to handle the request due to maintenance or overload. Should include a Retry-After header.

When You See It

During maintenance windows, server overload, or when the application pool is exhausted.

How to Fix

Wait and retry. Check the Retry-After header. Scale up servers if it's a capacity issue.

Key Differences

1.

406 is a 4xx Client Error response, while 503 is a 5xx Server Error response.

2.

HTTP 406: The server cannot produce a response matching the Accept headers sent by the client.

3.

HTTP 503: The server is temporarily unable to handle the request due to maintenance or overload. Should include a Retry-After header.

4.

You encounter 406 when when requesting a content type the server doesn't support (e.g., Accept: application/xml when only JSON is available).

5.

You encounter 503 when during maintenance windows, server overload, or when the application pool is exhausted.

When to Use Which

For 406 (Not Acceptable): Adjust the Accept header to a format the server supports. For 503 (Service Unavailable): Wait and retry. Check the Retry-After header. Scale up servers if it's a capacity issue.

Learn More