About the "302 Found" HTTP Status Code

Code 302 concerns request/response transactions between web clients and servers, and means "Found" (but the requested resource is somewhere else, and only temporarily, so don't change your bookmark yet). It is an HTTP (Hyper-Text Transfer Protocol) redirection response status code meaning that (warning: more geek material ahead):

...the requested resource has been temporarily moved to the URL in the Location (response [sic]) header.
A browser receiving this status will automatically request the resource at the URL in the Location header, redirecting the user to the new page. Search engines receiving this response will not attribute links to the original URL to the new resource, meaning no SEO value is transferred to the new URL.

302 Found -HTTP | MDN

With the Internet Engineering Task Force (IETF) Request for Comments (RFC) starting with RFC 1945 for the HTTP/1.0 specification, 302 Found gives a response to an HTTP client that:

The requested resource resides temporarily under a different URI.
Since the redirection might be altered on occasion, the client ought to continue to use the target URI for future requests.

RFC 9110: HTTP Semantics

Here is an example 302 Found request and response transaction:

request from browser to 301gone.com server:
GET / HTTP/1.1
Host: 301gone.com
User-Agent: FooBrowser/8.10.1
Accept: */*


  
response from 301gone.com:
HTTP/1.1 302 Found
Date: Thu, 07 Aug 1999 12:34:56 GMT
Server: APatchy
Access-Control-Allow-Origin:*
Location: http://302found.com/


  
2nd request (this time made to 302found.com if browser honors the CORS header):
GET / HTTP/1.1
Host: 302found.com
User-Agent: FooBrowser/8.10.1
Accept: */*


  
response from 302found.com:
HTTP/1.1 200 OK
Date: Thu, 07 Aug 1999 12:34:57 GMT
Server: APatchy
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

<!DOCTYPE html>
<html>
<head><title>302 Found</title>
...
  

*note that in this example the 302 Found redirection is made to a different domain than that of the request. Most browsers (all?), will not follow the redirection unless an "Access-Control-Allow-Origin" (CORS) header is returned in the response. Usually 302 redirection stays on the same domain and port, only redirecting the path, and CORS is not necessary. 👍

About 302found.com

302found.com maintained by Pablo, is a space for the author to implement ideas and practice coding CSS, HTML, Javascript, MySQL/MariaDB, PHP, Python, and frameworks such as MooTools & VueJS on a live website. Most of the content consists of toy apps or snippets (some quite old), and all are probably broken on some browser or platform. In fact, some only work on the most recent versions of browsers when they were written, and an attempt is made to modernize old code to keep-up with new browsers. The blog (a wiki of-sorts), was created to remind the author of how to do this or that programming or tinkering task.

Contact

Please contact click to show with any Questions, Qomments, or Qoncerns.