How to prevent large responses to trigger 502 errors