We have a Jersey/Grizzly server which serves as our REST backend. Certain requests can easily take longer than 30s to process, which is perfectly normal. Sadly, Heroku terminates the connection after 30s with a H12 "request timeout" error.
It would appear that in order for a request to take longer than 30s, the server must periodically send some data to keep the connection open. See here: https://devcenter.heroku.com/articles/limits#http-timeouts
So the question is: How does one send data without terminating the response?
Here is how we create our server:
final String baseUri = "http://0.0.0.0:" + port;
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(URI.create(baseUri), rc);