Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Website returns 302 instead of 200

Well this one freaks me out. I used a Http Header check tool to check the headers of my webpage and guess what. In every request the response was 302 instead of 200.

domain.con
www.domain.con
http://www.domain.con

So, am i missing something here? I have not placed any redirect in any way.

So where the f#$% my website redirects? Is there a security hole?

UPDATE: While googling found this one

like image 370
OrElse Avatar asked Aug 05 '10 09:08

OrElse


People also ask

What causes a 302 redirect?

What is an HTTP 302? The 302 status code is a redirection message that occurs when a resource or page you're attempting to load has been temporarily moved to a different location.

How do I stop 302 redirects?

If the HTTP library which you are using does not enable you to control this behavior, you can set an additional header X-If-No-Redirect with a value of 1 . This will prevent our servers from responding with a 302 status code in the case of a redirect.

What does Response code 302 indicate?

The HyperText Transfer Protocol (HTTP) 302 Found redirect status response code indicates that the resource requested has been temporarily moved to the URL given by the Location header.

How do I fix my 302 response?

You can follow these five steps to fix HTTP 302 errors on your website: Determine whether the redirects are appropriate or not by examining the URLs that are issuing the 302 redirects. Check your plugins to make sure any redirect settings are valid. Ensure that your WordPress URL settings are configured correctly.


3 Answers

domain.com is not the same as www.domain.com - that's a redirect.

like image 58
Oded Avatar answered Oct 15 '22 11:10

Oded


You are getting this because .net/IIS redirects your www.domain.com or domain.com to www.domain.com/default.aspx, so you get a header with 302 and then one for 200. I think this is by design but very confusing.

like image 40
Anthony Avatar answered Oct 15 '22 11:10

Anthony


Maybe a case of this:

302 Found

This is the most popular redirect code, but also an example of industrial practice contradicting the standard. 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, the majority of Web applications and frameworks still use the 302 status code as if it were the 303.

303 See Other (since HTTP/1.1)

The response to the request can be found under another URI using a GET method. When received in response to a PUT, it should be assumed that the server has received the data and the redirect should be issued with a separate GET message.

http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

like image 39
Radu Avatar answered Oct 15 '22 10:10

Radu