What Is Status Code: 308 Permanent Redirect? The Unbreakable Redirect

Learn what HTTP status code 308 Permanent Redirect means, how it differs from 301 and 307, and when to use it. Discover SEO implications, real-world examples, and how to test 308 responses with Apidog for free.

INEZA Felin-Michel

INEZA Felin-Michel

24 September 2025

What Is Status Code: 308 Permanent Redirect? The Unbreakable Redirect

You're refactoring your API. You've decided that the endpoint POST /api/v1/create-user is poorly named and needs to be changed to the more accurate POST /api/v1/users. This is a permanent, structural change. You know you need a redirect, but you have a critical requirement: any application that POSTs data to the old endpoint must have its data perfectly preserved and forwarded to the new one.

This is a job for a specialized tool. It's not a job for the familiar 301 Moved Permanently, which can be ambiguous. It requires the precision and power of the 308 Permanent Redirect status code.

The 308 is the ultimate guarantee in the HTTP redirect family. It's a permanent, method-preserving, body-preserving, no-nonsense command from the server. It says, "I have moved forever. When you send any request to my old address whether it's a simple GET or a complex POST with data I insist that you resend the exact same request to my new address."

So, what does status code 308 actually mean? How is it different from 301 or 307? And when should you use it in real-world scenarios?

If you're building APIs that handle non-GET requests, understanding 308 is essential for maintaining backward compatibility and ensuring data integrity during migrations.

And before we dive into the technical specifics, if you're managing API endpoints that are evolving, you need a tool that can test these critical, method-sensitive redirects. In this comprehensive blog post, we’ll explore everything you need to know about the 308 Permanent Redirect status code from what it means and how it works to when and why you should use it. Additionally, to help you test and document complex HTTP responses effectively, don’t forget to download Apidog for free, a user-friendly API testing and documentation tool engineered to simplify your workflow and give you deep insights into HTTP status codes like 308.

button

Now, let’s unravel the details behind HTTP status code 308 Permanent Redirect.

The Problem: The 301 Moved Permanently Ambiguity

To understand why 308 was created, we must first look at its predecessor, the 301 Moved Permanently.

The 301 redirect is fantastic for most common web browsing scenarios. However, its original specification had a crucial ambiguity, much like the 302/307 situation. The spec did not explicitly state what should happen to the HTTP method and body of the original request during the redirect.

In practice, many user agents (especially web browsers) would change a POST request to a GET request when following a 301 redirect. The request body would be dropped.

The API Developer's Nightmare Scenario:

  1. A mobile app POSTs JSON data to your old endpoint: POST /old-api {"name": "John"}
  2. Your server responds with: 301 Moved Permanently + Location: /new-api
  3. The mobile app's HTTP library follows the redirect by sending: GET /new-api (with no body)
  4. Your /new-api endpoint, expecting a POST with JSON, receives a GET and returns a 405 Method Not Allowed error.
  5. The mobile app breaks for all its users.

The 308 status code was introduced to solve this problem with absolute precision.

What Does HTTP 308 Permanent Redirect Actually Mean?

The 308 Permanent Redirect status code indicates that the target resource has been assigned a new permanent URI. The key differentiator is that the user agent MUST NOT change the request method used in the original request when it makes the redirected request.

Furthermore, the body of the original request must be preserved and resent.

In simple terms: "The resource has moved forever. Resend the identical request to this new location."

A typical 308 response looks like this:

HTTP/1.1 308 Permanent RedirectLocation: <https://new-api.example.com/v2/usersContent-Type:> text/htmlContent-Length: 147
<html><head><title>308 Permanent Redirect</title></head><body><center><h1>308 Permanent Redirect</h1></center></body></html>

The crucial elements are the status code itself (308) and the Location header. The HTML body is often ignored by automated clients.

Why Redirects Matter in HTTP

Redirects are a fundamental part of the web. They let servers communicate changes in resource location without breaking clients.

Some common use cases include:

Without redirects, developers would constantly face 404 Not Found errors and broken user experiences.

Why Was 308 Permanent Redirect Introduced?

The older 301 status code instructs clients to update URLs permanently. However, browsers historically changed HTTP methods like POST to GET when following 301 redirects, causing unintended behavior like losing form data or unexpected responses.

To address these limitations, the RFC 7538 specification introduced 308 Permanent Redirect to explicitly guarantee that user agents:

This makes 308 especially useful in APIs and web applications that require method consistency along the redirection path.

308 vs. 301: The Critical Comparison

This is the most important distinction for API developers.

Feature 301 Moved Permanently 308 Permanent Redirect
Method Preservation Not guaranteed. Browsers often change POST to GET. Guaranteed. The method must be identical (POST remains POST).
Body Preservation Not guaranteed. The request body is typically dropped. Guaranteed. The original request body is resent.
Use Case Perfect for permanent redirects of web page URLs (where the original request is almost always GET). Essential for permanent redirects of API endpoints that handle POST, PUT, DELETE.
Safety Potentially unsafe for non-GET methods. Safe for all HTTP methods.
Analogy "That shop has a new permanent address. Go check it out." (You go empty-handed). "The entire factory has relocated. Send all future shipments, exactly as packaged, to this new warehouse address."

When to use which?

How Does 308 Permanent Redirect Work?

Here’s the typical flow of a 308 redirect:

  1. Client makes a request:
POST /checkout HTTP/1.1
Host: shop.example.com

2.  Server responds with 308:

HTTP/1.1 308 Permanent Redirect
Location: <https://secure.example.com/checkout>

3.  Client repeats the POST request at the new location, preserving body and headers:

POST /checkout HTTP/1.1
Host: secure.example.com

No method switching. No surprises. Since the redirect is permanent, clients are expected to update bookmarks and internal references accordingly.

Use Cases for 308 Permanent Redirect

308 redirects fit best in scenarios where:

A Real-World Example: API Migration

Imagine you are versioning your API and need to retire an old endpoint.

The Old System:

The New System:

You want to shut down the v1 server but don't want to break old clients that haven't updated. Your solution is a 308 redirect on the v1 server:

1. The Old Client's Request: A legacy app sends a request to the old endpoint.

POST /v1/orders HTTP/1.1Host: api.example.comContent-Type: application/json
{"product_id": "abc123", "quantity": 2}

2.  The 308 Response: The v1 server responds with a redirect to the v2 endpoint.

HTTP/1.1 308 Permanent RedirectLocation: <https://api.example.com/v2/orders>

3.  The Preserved Request: The client's HTTP library respects the 308 spec. It resends the exact same POST request with the exact same JSON body to the new location.

POST /v2/orders HTTP/1.1Host: api.example.comContent-Type: application/json
{"product_id": "abc123", "quantity": 2} # The original body is preserved!

4.  The Successful Order: The v2 server processes the request and creates the order, returning a 201 Created response. The legacy client works perfectly without any code changes.

This approach provides a seamless and robust migration path for API consumers.

Example: Implementing a 308 Redirect After URL Change

Imagine a REST API where a resource’s URI changed:

  1. Client sends a POST request to http://api.example.com/v1/resource.
  2. Server responds:

textHTTP/1.1 308 Permanent Redirect Location: <https://api.example.com/v2/resource>

3.  Browser or client resends the POST request, unchanged, to https://api.example.com/v2/resource.

4.  API processes the request as intended.

This preserves the request semantics and ensures smooth migration.

Benefits of 308 Permanent Redirect

How to Implement 308 Redirects

Implementation depends on your server or platform.

Apache (.htaccess or config)

textRedirectPermanent 308 /old-path <https://example.com/new-path>

Nginx

textlocation /old-path {     return 308 <https://example.com/new-path>; }

Express.js (Node.js)

javascriptapp.post('/old-path', (req, res) => {   res.redirect(308, '<https://example.com/new-path>'); });

How Clients Handle 308 Redirects

Because 308 is a relatively new code, client support varies but is widely adopted in modern browsers and HTTP libraries:

308 in API Development and Microservices

For APIs and microservices, 308 is a game-changer.

Imagine this:

This makes 308 invaluable for mission-critical API traffic.

Testing 308 Redirects with Apidog

Testing this behavior is non-negotiable for a production API. You must ensure that your redirects work correctly and that clients will behave as expected. Apidog is an indispensable tool for this.

With Apidog, you can:

1. Craft a POST Request: Create a request to your old endpoint URL with a specific JSON or XML body.

2. Mock the 308 Response: Configure your server mock to return a 308 status with the new Location header.

3. Validate the Redirected Request: The most crucial step. After sending the request, use Apidog's detailed logs to inspect the second request that was automatically sent.

4.  Compare with 301: Run the same test but have the mock return a 301 instead. Observe how Apidog (acting as a standard client) likely changes the method to GET and drops the body. This side-by-side comparison is the best way to understand the practical difference.

5.  Test Client Libraries: If you're building an SDK or client, use Apidog to mock the server and ensure your client code correctly handles a 308 response by preserving the method and body.

button

Download Apidog for free to make redirect testing painless and reliable and try mocking a 308 redirect yourself it takes minutes to set up.

SEO Implications

Unlike 301, the 308 code is primarily for APIs, not web pages. Most web crawlers from search engines like Google primarily make GET requests. For them, a 301 and a 308 would have the same effect: they would update their index to the new URL and transfer ranking signals.

However, you should still use 301 for permanent page moves on your website. It is the universally supported and expected standard for HTML content, and its behavior is well-understood by all web crawlers and browsers. Use 308 for the programmatic, data-oriented parts of your system.

Common Pitfalls to Avoid

When Not to Use 308

Alternatives to 308 Permanent Redirect

Depending on your needs:

308 is the best fit when you want permanent + method-preserving behavior.

Security Considerations for 308 Redirects

Redirects can be abused if not handled carefully. With 308:

308 is safer than 301 for preserving sensitive methods, but it’s still important to configure it securely.

Conclusion: The Precision Tool for API Evolution

The HTTP 308 Permanent Redirect status code is a specialist tool designed for a specific, critical job: ensuring the integrity of non-GET requests during permanent API migrations. It represents the HTTP protocol's evolution towards greater precision and reliability, closing the dangerous ambiguities of its predecessors.

HTTP status code 308 Permanent Redirect offers a modern, precise way to handle permanent URL changes while preserving HTTP methods, making it invaluable for APIs and web applications that rely on method consistency.

While you may use 301 redirects every day for your website, the 308 is the tool you reach for when the stakes are higher when you need to guarantee that data is not lost, that API clients don't break, and that your backend evolution happens smoothly.

By using 308 correctly, you can improve user experience, preserve the integrity of requests, and protect your SEO investment.

Understanding this distinction is a key differentiator between a developer who understands web basics and one who architects robust, professional systems. And when it's time to implement and test these critical redirects, to test and document your API endpoints especially those involving redirects don’t forget to download Apidog for free. Apidog empowers you to explore HTTP status codes like 308 thoroughly, helping you develop with confidence and clarity.

button

Explore more

What Is Status Code: 307 Temporary Redirect? The Precision Redirect

What Is Status Code: 307 Temporary Redirect? The Precision Redirect

Learn what HTTP status code 307 Temporary Redirect means, how it differs from 302, and when to use it. Explore real-world examples, SEO implications, and how to test 307 responses using Apidog for free.

24 September 2025

Can Qwen3-Max Outperform Leading AI Models in Coding and Reasoning?

Can Qwen3-Max Outperform Leading AI Models in Coding and Reasoning?

Alibaba's Qwen3-Max arrives as a game-changing trillion-parameter AI model, dominating benchmarks in coding, math, and agentic tasks. This technical breakdown covers its specifications, performance comparisons, and seamless API integration.

24 September 2025

Is there a quota or rate limit for Codex usage?

Is there a quota or rate limit for Codex usage?

Wondering about Codex quotas? This guide covers usage limits by plan, API key escapes, and community hacks from Reddit and GitHub to beat rate limits and keep your AI coding sessions uninterrupted.

23 September 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs