Mantis - Resin
Viewing Issue Advanced Details
1075 major always 04-26-06 05:00 06-28-06 12:03
rudy  
ferg  
normal  
closed 3.0.18  
fixed  
none    
none 3.0.20  
0001075: SSI - error handling and mod_caucho
We want to conditionally hide all errors coming back from resin. The desired behaviour is that errors for components (ie: SSI includes) are simply removed, and that errors in top-level pages are replaced with a custom error page defined in the Apache configuration.

This works fine in our existing architecture (with an analogous backend
server and Apache module) by using the SSIErrorMsg directive for includes,
and the ErrorDocument directive for top-level pages.

However when using Resin's supplied Apache2 module, mod_caucho returns OK
for every result of a request except a 503. This indicates to Apache and
other modules, such as mod_ssi, that it considers the page/component to
have generated succesfully. Hence, the error directives mentioned
previously are never called. The value of the status on the request struct
isn't considered for this, only the returned value.

In particular at the end of thte 'caucho_request' function, replacing the
lines

else if (r->status == HTTP_SERVICE_UNAVAILABLE)
return HTTP_SERVICE_UNAVAILABLE;
else
return OK;

with

} else if (r->status == HTTP_OK) {
return OK;
} else {
// Error occured
st = r->status;
r->status = HTTP_OK;
return st;
}

results in mod_ssi behaving as expected. The status on the request
structure needs to be set to HTTP_OK (200), as otherwise Apache will think
an internal error has occurred. Apache will set r->status to the returned
error code by itself at the appropriate time.


There are no notes attached to this issue.