1. HTTP (Hypertext Transfer Protocol)

  1. HTTP Status Codes

  1. 308 Permanent Redirect
    1. Writing responses (servers)
    2. Reading responses (clients)
    3. Overview table
    4. Example
    5. Implementations
      1. cURL
      2. Nginx
    6. History
      1. 2015-04: RFC 7538
      2. 2022-06: RFC 9110: HTTP Semantics.

308 Permanent Redirect

The 308 Permanent Redirect HTTP status code tells clients the request was not filled, but the resource has been moved to another location; the client must update references with the old URI and re-issue the request at the new URI to complete the operation.

Writing responses (servers)

Servers should produce 308 Permanent Redirect when a resource or set of resources has been assigned a new URI, especially one at a different authority/origin server.

308 redirects can typically be configured as a search-and-replace on the request-URI.

For a period of time, servers should instead issue 307 Temporary Redirect, so that if there is an error in the redirect, it won't cause clients to adjust their bookmarks to a URI that doesn't exist.

Reading responses (clients)

308 Permanent Redirect is an indication the client should adjust references to a different URI. If the client has any bookmarks, they should first be updated to the new URI.

Then, the request should be re-tried at the URI.

The server doesn't necessarily know anything about the target URI; the request at the redirect target might fail, but this doesn't change handling of the 308 response.

Overview table

Name
308
Message
308 Permanent Redirect
Description
The resource has moved to a different URI and the request must be re-made.
Specification
RFC 7538: The Hypertext Transfer Protocol Status Code 308 (Permanent Redirect)

Example

HTTP/1.1 308 Permanent Redirect

Implementations

cURL

cURL correctly supports 308 redirects by following generic 300 semantics, if the response includes a Location header. It does not provide an explicit mechanism to rewrite or update URL references. A test for this status code was added in cURL 7.24.0.

Nginx

Nginx will send 308 Permanent Redirect when you use a rewrite rule with the permanent flag:

# Redirect www.example.com to example.com
server {
	listen 80;
	server_name www.example.com;

	location / {
		rewrite  ^(/.*)  https://example.com$1  permanent;
	}
}

History

2015-04: RFC 7538

This status code largely replaces the 301 Moved Permanently status code, which has a more ambiguous definition, and is inconsistently implemented by Web browsers. See the specification text for more information.

2022-06: RFC 9110: HTTP Semantics.

The 308 status code is incorporated into HTTP Semantics.