How long is a 302 redirect saved in browser?

It shouldn’t be cached at all unless there’s also a Cache-Control or Expires header returned by the web server. According to RFC 2616, section 10.3.3 302 Found The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. … Read more

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

I had the same problem. Here’s how I solved it. In IIS7, click on your website, then double-click the Authentication button. Click on Anonymous Authentication, then click the Edit… link on the right hand side. Make sure the “Application pool identity” checkbox is checked. My application pool is running under the “Network Service” user (not … Read more

301 or 302 Redirection With PHP

For a 302 Found, i.e. a temporary redirect do: header(‘Location: http://www.example.com/home-page.html’); // OR: header(‘Location: http://www.example.com/home-page.html’, true, 302); exit; If you need a permanent redirect, aka: 301 Moved Permanently, do: header(‘Location: http://www.example.com/home-page.html’, true, 301); exit; For more info check the PHP manual for the header function Doc. Also, don’t forget to call exit; when using header(‘Location: … Read more

Sending browser cookies during a 302 redirect

According to this blog post: http://blog.dubbelboer.com/2012/11/25/302-cookie.html all major browsers, IE (6, 7, 8, 9, 10), FF (17), Safari (6.0.2), Opera (12.11) both on Windows and Mac, set cookies on redirects. This is true for both 301 and 302 redirects. As @Benni noted : https://www.chromium.org/administrators/policy-list-3/cookie-legacy-samesite-policies The SameSite attribute of a cookie specifies whether the cookie should … Read more

jQuery and AJAX response header

cballou’s solution will work if you are using an old version of jquery. In newer versions you can also try: $.ajax({ type: ‘POST’, url:’url.do’, data: formData, success: function(data, textStatus, request){ alert(request.getResponseHeader(‘some_header’)); }, error: function (request, textStatus, errorThrown) { alert(request.getResponseHeader(‘some_header’)); } }); According to docs the XMLHttpRequest object is available as of jQuery 1.4.