308
HTTPREDIRECTNotable3xx RedirectionHIGH confidence

Permanent Redirect

Production Risk

Low if used correctly. Incorrect use can break API integrations that do not expect the redirect or the strict method preservation.

What this means

The resource has been permanently moved to a new URI, and future requests should be sent there. Like 301, but it does not allow changing the request method from POST to GET. Search engines will update their links to the new location.

Why it happens
  1. 1An API endpoint that accepts POST requests is permanently moved to a new URL.
  2. 2A website restructures, and resources that were targets of non-GET requests are moved.
  3. 3Used when a permanent redirect is needed, and the method of the original request must be maintained.
How to reproduce

A web service migrates its API from /api/v1 to /api/v2 and needs to permanently redirect POST requests to the new endpoints.

trigger — this will error
trigger — this will error
POST /api/v1/resource HTTP/1.1
Host: example.com
Content-Type: application/json

{ "key": "value" }

expected output

HTTP/1.1 308 Permanent Redirect
Location: https://api.example.com/v2/resource

Fix

Update Client-Side Links

WHEN You control the client making the request.

Update Client-Side Links
// Old: const API_URL = '/api/v1/resource';
// New: const API_URL = '/api/v2/resource';

Why this works

Code Update

What not to do

Version notes

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All HTTP errors