2

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)?

123.201.40.136 - - [09/Feb/2011:14:13:23 -0800] "GET /report/now HTTP/1.0" 302 20 "http://foo.bar.com/reports/nowreport.swf" 
123.201.40.136 - - [09/Feb/2011:14:13:28 -0800] "GET /report/now HTTP/1.0" 302 20 "http://foo.bar.com/reports/nowreport.swf" 
123.201.40.136 - - [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" 
Lothar_Grimpsenbacher
  • 1,647
  • 3
  • 18
  • 27

1 Answers1

2

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.

Arnaud.

aligot
  • 318
  • 1
  • 7