Application error passthru when using apache mod_proxy

12,329

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.

Share:
12,329
Andrew Taylor
Author by

Andrew Taylor

Updated on June 26, 2022

Comments

  • Andrew Taylor
    Andrew Taylor about 2 years

    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

  • mick88
    mick88 about 5 years
    My problem appears to be not with apache, but with mod_wsgi-express.