Don’t send all the stack trace of an exception to client if Apache Httpd is used as reverse proxy. Otherwise, it may return Http 502 to your client.
It may say the following just because the response from your servlet container(tomcat etc.) is too big in size:
502 Bad Gateway The proxy server received an invalid response from an upstream server.