Working more with our setup we started encountering “502 – Bad Gateways” errors when allowing users to run expensive queries on our database and give them the option to export the results. A temporary solution was to increase the ARR timeout as described in this blog post; the server farm settings are relevant for this case.
However, this still leaves us with the problem of some browser timing out on lengthy requests, so that we are now looking into an AJAX solution for decoupling the JBoss transaction from the front-end.