HTTP 308 Permanent Redirect — Method-Preserving vs 301
The resource has permanently moved to the URL in the Location header, and the HTTP method must not change. The method-preserving counterpart to 301. Search engines update the indexed URL. Browsers cache the redirect.
When to Return 308
Use 308 instead of 301 when permanently redirecting API endpoints where the method must be preserved (POST stays POST). For web pages redirected via browser, 301 works fine since browsers typically send GET regardless.
Common Causes
- Permanent API endpoint migration where method must be preserved
HTTP Response Example
HTTP/1.1 308 Permanent Redirect
Location: /api/v2/users
Cache-Control: max-age=31536000Code Examples
Express.js
// Permanent method-preserving redirect
app.all('/api/v1/:path(*)', (req, res) => {
res.redirect(308, `/api/v2/${req.params.path}`)
})Next.js App Router
// Next.js uses 308 for permanent: true redirects
export default {
redirects: async () => [
{
source: '/old-page',
destination: '/new-page',
permanent: true, // 308
},
],
}Related Status Codes
Frequently Asked Questions
What does HTTP 308 Permanent Redirect mean?
The resource has permanently moved to the URL in the Location header, and the HTTP method must not change. The method-preserving counterpart to 301. Search engines update the indexed URL. Browsers cache the redirect.
When should an API return 308?
Use 308 instead of 301 when permanently redirecting API endpoints where the method must be preserved (POST stays POST). For web pages redirected via browser, 301 works fine since browsers typically send GET regardless.
What causes an HTTP 308 error?
Common causes: Permanent API endpoint migration where method must be preserved.
