Mantis - Resin
Viewing Issue Advanced Details
4804 major always 10-13-11 11:57 10-19-11 12:48
richardmoco  
ferg  
normal  
closed 4.0.22  
fixed  
none    
none 4.0.24  
0004804: Resin Throws 500 HTTP header incorrectly on caught exception
we have code that checks for application level 'log in'. A 'not logged in' user is identified with a caught exception and redirected to an error.jsp page. However the returned page header still shows that a 500 error code was sent. This is bad as the handled page should return a 200 (OK) code.
The following URL will have been refused and redirected as its content is restricted by application logic. The redirect page is displayed correctly however resin also returns a 500 error code :

"GET /fake/path/to/content-list.jsp?r=128&u=43741853 HTTP/1.1" 500 997 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1" 244000

We even added a error code 200 override to the error page that handles the request, and the page is returned with a 200 in the header, however the resin server _still_ records the 500.

Notes
(0005562)
richardmoco   
10-13-11 12:01   
as to the last line, "however the resin server _still_ records the 500.", it still records the 500 error in the access log
(0005563)
richardmoco   
10-13-11 12:19   
This issue does not occur in the version we currently use (4.0.6) and is stopping us from upgrading to this otherwise great looking version ...
(0005564)
ferg   
10-19-11 11:36   
I'm checking against the JSP/Servlet TCK. The 500 as default error-page behavior might be mandated by the spec.

The access log would be a Resin bug in either case.
(0005565)
ferg   
10-19-11 12:48   
server/02ei.

You will still need to call the response.setStatus(200) in the error page if you want to change the status from the error's default. It will now be logged correctly.