HTTP

HTTP 308 Permanent Redirect vs 411 Length Required

HTTP 308 (Permanent Redirect) is a 3xx Redirection response, while 411 (Length Required) 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, 411 means that the server refuses to accept the request without a Content-Length header.

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 refuses to accept the request without a Content-Length header.

When You See It

When sending a request body without specifying Content-Length.

How to Fix

Include a Content-Length header in your request.

Key Differences

1.

308 is a 3xx Redirection response, while 411 is a 4xx Client Error response.

2.

HTTP 308: The resource has been permanently moved. Like 301, but guarantees the HTTP method will NOT be changed.

3.

HTTP 411: The server refuses to accept the request without a Content-Length header.

4.

You encounter 308 when for permanent URL changes where POST requests must remain POST.

5.

You encounter 411 when when sending a request body without specifying Content-Length.

When to Use Which

For 308 (Permanent Redirect): Update all references to the new URL. The HTTP method is preserved. For 411 (Length Required): Include a Content-Length header in your request.

Learn More