views:

227

answers:

1

Heyas. I'm using mod_proxy with apache2 provide vhost ability to multiple servlet apps running on the local machine. It works fine, for the most part. Requests come into apache then are directed to the application bound on a port on localhost. The app receives the request and responds, which is delivered back to the client by apache.

The problem I'm having is that the application delivers 500's on errors, and mod_proxy stomps on them. Often these errors are caused in a ajax request and the error is handled in client side javascript. For example, a call to a server side createObject(name) might throw a NameNotUniqueException , which is delivered back as a 500. The client javascript might then display an appropriate error message.

When an error is thrown by the application (resulting in a 500 response to mod_proxy), then apache stomps the error message and returns

500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

.. the stock apache server side error message.

I want mod_proxy to pass the original 500 back through to the client. Is there a directive I've missed which prevents clobbering of the 500?

TIA

A: 

Do you have

 ProxyRequests Off
 ProxyErrorOverride Off
 ProxyPass /path/ http://backend.ip/path/
 ProxyPassReverse / http://backend.domain/

Replace backend.ip and backend.domain with your values (i am using backend.ip here as it prevents apache from running dns queries on each request).

Usually errors are reported as is. Because ProxyErrorOverride defaults to off. If this doe not happen with my configuration, please check if the 500 is really from your backend server. Or just show us your complete proxy configuration.

Janning