Products

Solutions

Resources

Search for API Security Tests

/

/

302 Status Code - Found

302 Status Code - Found

In this section you will learn about 302 Status Code, what is it, its components and examples.

In this section you will learn about 302 Status Code, what is it, its components and examples.

302 Status Code - Found
302 Status Code - Found
302 Status Code - Found

Luke Stephens

Luke Stephens

Luke Stephens

What is HTTP Status Code 302 - Found?

The HTTP Status Code 302, labeled as "Found" or sometimes referred to as "Temporary Redirect", is a redirection response status code. It suggests that the resource the client is trying to reach temporarily resides at a different URI. Unlike the 301 Moved Permanently, which indicates a permanent move, the 302 Found status communicates a temporary redirection, implying that clients should continue using the original URI for future requests.

Understanding 302 Found

  • Temporary Redirection: The 302 Found status code communicates that the resource the client is seeking has been temporarily relocated to another URI. It's a hint that this redirection might not persist indefinitely.

HTTP/1.1 302 Found
  • Location Header: Alongside the 302 Found status code, the Location header is often included, pinpointing the temporary URI where the requested resource can currently be found.

Location: <https://www.example.com/temporary-resource>

Why 302 Found?

The 302 Found status code is beneficial when the content has been shifted to another location for a limited period. For example, it can be used during website maintenance, A/B testing, or for promotional content that will only be relevant for a short duration.

Benefits of 302 Found

  • Flexibility: The 302 redirect offers flexibility, enabling temporary content shifts without affecting the original URL's SEO value or user bookmarks.

  • SEO: Unlike the 301 redirect, search engines recognize the temporary nature of a 302 redirect and typically keep the original URL indexed.

How does 302 Found Work?

  1. Client Sends a Request:

    The client sends a request to a specific resource on the server using a URL.

GET /promotional-page HTTP/1.1
Host: www.example.com
  1. Server Sends a Response:

    The server, discerning that the resource has been temporarily moved, returns a 302 Found response, coupled with a Location header pointing to the new URI.

HTTP/1.1 302 Found
Location: https://www.example.com/new-promotion

Components of a 302 Found Response

Within a 302 Found response, you'll typically encounter:

  • Status Line: The initial line of the response, signaling the 302 Found status code.

HTTP/1.1 302 Found
  • Headers: The Location header is pivotal, as it indicates the new temporary URI where the resource can be accessed.

Examples of 302 Found

Website Maintenance:

GET /user-profile HTTP/1.1
Host: www.example.com

Response:

HTTP/1.1 302 Found
Location: https://www.example.com/maintenance-page

Here, a user profile page is temporarily unavailable due to maintenance. Users trying to access it are met with a 302 Found status code, redirecting them to a maintenance notification page. Once maintenance concludes, the original URL will again provide direct access to the user profile page.

Conclusion

The 302 Found status code allows developers to temporarily reroute traffic without affecting the SEO value of the original URL or causing any long-term changes. Grasping the 302 Found status code is essential for anyone working with websites or web applications, as it provides a tool for managing temporary content changes, website maintenance, or promotional campaigns.

Learn about other codes in 3xx family of HTTP status codes such as 301, 304 and 307.

On this page

Protect your APIs from attacks now

Protect your APIs from attacks now

Protect your APIs from attacks now

Explore more from Akto

Blog

Be updated about everything related to API Security, new API vulnerabilities, industry news and product updates.

Events

Browse and register for upcoming sessions or catch up on what you missed with exclusive recordings

CVE Database

Find out everything about latest API CVE in popular products

Test Library

Discover and find tests from Akto's 100+ API Security test library. Choose your template or add a new template to start your API Security testing.

Documentation

Check out Akto's product documentation for all information related to features and how to use them.