Bad Gateway when accessing specific application preview page



I keep getting a 502 - Bad Gateway error when I access a particular route in my app. When I try to preview the app, my browser hangs for a long time before eventually displaying raw HTML for a 502 error page. I don’t see any errors in my console when this happens.


Does it work if you use curl to access that page from localhost?

This error most often happens when the server doesn’t respond to the request, (e.g. in node that can happen if req.end is not called)


It works, but it’s just redirecting me. The page with the problem requires (passport) authentication, and redirects to a login page without it. I’m just a novice and I am not sure how to use curl to access the page if it requires authentication.

Okay, I think I managed it but I got an error. This is what CURL returned:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<pre>Cannot POST /questions/596e313d047cca0a8fdde74c/edit</pre>


I don’t know why it is trying to POST… it shouldn’t be.


Any updates or ideas on this? Anyone?

I’ve found a lot of forum posts reporting this or similar issues over time but I have never seen any solutions posted.


i believe the error is in your code, most likely the server you are running doesn’t send response correctly.

But if you think it is caused by the proxy, please tell me the url of the page that is failing, and i will take a look.