HTTP 308 Permanent Redirect vs 406 Not Acceptable
HTTP 308 (Permanent Redirect) is a 3xx Redirection response, while 406 (Not Acceptable) is a 4xx Client Error response. 308 indicates that the resource has been permanently moved. Like 301, but guarantees the HTTP method will NOT be changed. In contrast, 406 means that the server cannot produce a response matching the Accept headers sent by the client.
Description
The resource has been permanently moved. Like 301, but guarantees the HTTP method will NOT be changed.
When You See It
For permanent URL changes where POST requests must remain POST.
How to Fix
Update all references to the new URL. The HTTP method is preserved.
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.
Key Differences
308 is a 3xx Redirection response, while 406 is a 4xx Client Error response.
HTTP 308: The resource has been permanently moved. Like 301, but guarantees the HTTP method will NOT be changed.
HTTP 406: The server cannot produce a response matching the Accept headers sent by the client.
You encounter 308 when for permanent URL changes where POST requests must remain POST.
You encounter 406 when when requesting a content type the server doesn't support (e.g., Accept: application/xml when only JSON is available).
When to Use Which
For 308 (Permanent Redirect): Update all references to the new URL. The HTTP method is preserved. For 406 (Not Acceptable): Adjust the Accept header to a format the server supports.