I deployed a small servlet to a managed VM on App Engine that creates a zip archive with files from Google Cloud Storage. The same code works fine in App Engine instance, but when deployed to a managed VM the client gets 502 Bad gateway response.
When I replace code in this servlet with a simple:
resp.getWriter().println("Testing empty servlet");
it works as expected. Also, my log statements show that the original code is executed correctly: it reads entities from the Datastore, retrieves files from Cloud storage, and writes their content to response's OutputStream. So, everything works, except the browser gets this 502 error.
Anyone knows how to resolve this?