Questions tagged [http-status-code-302]

The HTTP response status code 302 Found is a common way of performing a redirection

This is an example of industry practice contradicting the standard. The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect (the original describing phrase was "Moved Temporarily"), but popular browsers implemented 302 with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307 to distinguish between the two behaviours. However, some Web applications and frameworks use the 302 status code as if it were the 303.

623 questions
441
votes
8 answers

HTTP redirect: 301 (permanent) vs. 302 (temporary)

Is the client supposed to behave differently? How?
flybywire
  • 261,858
  • 191
  • 397
  • 503
181
votes
8 answers

jQuery and AJAX response header

So I've got this jQuery AJAX call, and the response comes from the server in the form of a 302 redirect. I'd like to take this redirect and load it in an iframe, but when I try to view the header info with a javascript alert, it comes up null, even…
Shane
  • 1,811
  • 2
  • 12
  • 3
154
votes
16 answers

What does HTTP/1.1 302 mean exactly?

Some article I read once said that it means jumping (from one URI to another), but I detected this "302" even when there was actually no jumping at all!
omg
  • 136,412
  • 142
  • 288
  • 348
117
votes
9 answers

Sending browser cookies during a 302 redirect

Are there any issues with sending back a cookie during a 302 redirect? For example, if I create a return-to-url cookie and redirect the user in the same response will any (modern) browser ignore the cookie?
Abdullah Jibaly
  • 53,220
  • 42
  • 124
  • 197
96
votes
5 answers

Will a 302 redirect maintain the referer string?

I need to redirect the user from one page to another, but I need to maintain the original referer string. So, for example, if they start out on http://www.othersite.com/pageA.jsp, click a link that takes them to http://www.example.com/pageB.jsp,…
sangfroid
  • 3,733
  • 11
  • 38
  • 42
83
votes
6 answers

301 or 302 Redirection With PHP

I'm considering using the following code during a website launch phase to show users a down for maintenance page while showing me the rest of the site. Is there a way to show the correct 302 re-direction status to search engines or should I look…
toomanyairmiles
  • 6,465
  • 8
  • 43
  • 71
56
votes
5 answers

After a POST, should I do a 302 or a 303 redirect?

A common scenario for a web app is to redirect after a POST that modifies the database. Like redirecting to the newly created database object after the user creates it. It seems like most web apps use 302 redirects, but 303 seems to be the correct…
Kyle
  • 21,377
  • 37
  • 113
  • 200
45
votes
5 answers

Forms auth redirecting css/script includes to the login page with HTTP 302

I have some includes on a login page, a css file and a js file. the requests the browser…
Daniel Revell
  • 8,338
  • 14
  • 57
  • 95
44
votes
5 answers

Handle HTTP 302 response from proxy in angularjs

I have a reverse proxy that checks global authentication for several applications. When the user is disconnected but still trying to use my application, the proxy sends a 302 response : HTTP/1.1 302 Found Date: Wed, 11 Sep 2013 09:05:34…
D0m3
  • 1,471
  • 2
  • 13
  • 19
44
votes
6 answers

How long is a 302 redirect saved in browser?

Due to a misconfiguration of our webserver the main domain sent a 302 redirect to a new location. We fixed that issue. When emptying the browser cache everything works fine now. For the "normal" client who does not empty his cache: How long is the…
Ole Albers
  • 8,715
  • 10
  • 73
  • 166
40
votes
5 answers

Catching 302 FOUND in JavaScript

I use jQuery to make an AJAX POST request to my server, which can return HTTP response with status 302. Then JavaScript just sends GET request to this URL, while I'd like to redirect user to URL in this response. Is this possible?
Alexander Solovyov
  • 1,526
  • 1
  • 13
  • 21
26
votes
4 answers

Intercepting backend 301/302 redirects (proxy_pass) and rewriting to another location block possible?

We have a couple of backends sitting behind our nginx front ends. Is it possible to intercept 301 / 302 redirects sent by these backends and have nginx handle them? We were thinging something alone the lines of: error_page 302 = @target; But I…
24
votes
3 answers

How to redirect from HTTPS to HTTP without annoying error messages

I want to redirect users, after HTTPS login, to the HTTP pages on the site. Using HTTPS for the whole site is not going to happen. What I have so far is the following: User posts the login form to the secure site The secure server validates the…
Mr. Shiny and New 安宇
  • 13,822
  • 6
  • 44
  • 64
24
votes
7 answers

Httpclient 4, error 302. How to redirect?

I want to access one site that first requires an (tomcat server) authentication and then log in with a POST request and keep that user to see the site's pages. I use Httpclient 4.0.1 The first authentication works fine but not the logon that always…
juanmirocks
  • 4,786
  • 5
  • 46
  • 46
23
votes
4 answers

What is the 302 error code that jQuery AJAX is throwing?

I'm working with ASP.NET MVC and jQuery and I have a UserControl that is repeated on every page. In every page request, an AJAX callback occurs. So far so good. But when I'm in localhost and I publish the site, I notice that this AJAX is throwing a…
André Miranda
  • 6,420
  • 20
  • 70
  • 94
1
2 3
41 42