How to debug 502 Bad Gateway errors?

How do I debug 502 Bad Gateway errors? There is one topic in the Q&A section here, there is one part of one page in the docs here which lists some possibilities, but doesn’t help if your problem is not one of those.

FWIW, I am working on 2 apps in a single project, each of which is a static site, so it should be quite simple.

I am somewhat surprised at the paucity of information on it. Is there a log, or some way I can see, “this is what the system is doing,” so it actually is possible to work through the error?

I did find the logs information in the docs, and figured out from the logs that nginx is serving, so I was able to find nginx.conf, but it didn’t help much.

Despite it being a static site, the error.log is showing:

2022/11/15 09:26:53 [error] 203#0: *6 connect() failed (111: Connection refused) while connecting to upstream, client:, server: , request: "GET /metal/ HTTP/1.1", upstream: "", host: "****"

which itself is odd, since this is a static site. Wouldn’t it just serve it locally? When ssh into the container, I, too, cannot curl localhost:8888, but that is not too surprising as nothing is running there.

Is there some magic invocation necessary for it to be static?

Hi @avi-deitcher !

With multi-app, I think this is going to depend on how you’re defining routes.yaml and web.locations. If I had to guess, you’re getting the following error because you’ve defined the route for that application like this:

    type: upstream
    upstream: "app:http"

And web.locations like this:

          root: "app_subdir/build"

When defining a subdirectory route (https://{default}/metal/), you would also need to match that configuration in your web.locations block:

          root: "app_subdir/build"

I may be off without looking at the code, and I agree there could be something more helpful here as far as error messaged go. Let me know if this helps.

@chad-carlson yes! That did do it. Thank you, indeed.

Yeah, it needs more in terms of:

  • docs that these need to be synced, perhaps especially in the two “how to make a static site” pages (one in the docs and one in how-to guides in the community pages)
  • how to debug error messages

That leaves me much to figure out (one of the apps is painfully slow, maybe missing content, but that could equally be the static content itself, especially client-side JS dependencies).

If I see it is delivering slowly, I should ask a new question?

Thank you again @chad-carlson

Feel free to open another question or reach out to us on our Slack workspace as well ( Glad I could help! I’ll pass along your feedback to our documentation team.