In the following log snippet what could cause certain requests to return a 302 status and the last one to return a 200 status? As I understand it 302 means "The requested resource resides temporarily under a different URI" but why would this be? I would expect the response code to be 200, as in the last line of the log example, for every request.

Also wondering about the HTTP/1.0 versus 1.1 but I think I know that one so... really, just why the 302 versus 200 status codes for the same resource (that has not moved)? - - [09/Feb/2011:14:13:23 -0800] "GET /report/now HTTP/1.0" 302 20 "http://foo.bar.com/reports/nowreport.swf" - - [09/Feb/2011:14:13:28 -0800] "GET /report/now HTTP/1.0" 302 20 "http://foo.bar.com/reports/nowreport.swf" - - [09/Feb/2011:14:13:41 -0800] "GET /report/now HTTP/1.0" 302 20 "http://foo.bar.com/reports/nowreport.swf"
208.319.74.24 - - [09/Feb/2011:14:13:56 -0800] "GET /report/now HTTP/1.1" 200 355 "http://foo.bar.com/reports/nowreport.swf" 

An application could force Apache to return 302 to send back a 'Location:' header to the client browser.

For instance, in php if you write the following code:

<?php if ([condition]) header('Location: http://www.google.be'); ?>

if [condition] is evaluated to true, Apache will return 302 error instead of 200 if [condition] is evaluated to false.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.