Products

Solutions

Resources

/

/

302 Status Code - Found

302 Status Code - Found

This section offers a comprehensive guide on the 302 Status Code, covering its essential components and providing illustrative examples. You'll gain a clear understanding of what the 302 code signifies, how it functions within the framework of HTTP responses, and practical insights into its application through real-world scenarios.

This section offers a comprehensive guide on the 302 Status Code, covering its essential components and providing illustrative examples. You'll gain a clear understanding of what the 302 code signifies, how it functions within the framework of HTTP responses, and practical insights into its application through real-world scenarios.

302 Status Code - Found
302 Status Code - Found
302 Status Code - Found
Author image

Luke Stephens

Luke Stephens

Luke Stephens

What is 302 status code?

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 status code

  • 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 status code?

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 status code

  • 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 Http status code 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 HTTP Response Code 302, 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 Http Status Code 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.

E-Commerce Site Sale:

Request:

GET /summer-sale HTTP/1.1 Host: www.fashionstore.com

Response:

HTTP/1.1 302 Found Location: <https://www.fashionstore.com/winter-clearance>

In this example, an e-commerce site has ended its summer sale and started a winter clearance. Users trying to access the summer sale page are met with a 302 Found status code, redirecting them to the winter clearance page. Once the winter clearance ends, the summer sale URL can be used again for the next summer sale.

Final Thoughts

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 http status code is essential for developers 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 Status Code, 304 Status Code and 307 Status Code.

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.