The app was running. Caddy was still using the wrong port.
Traffic Diary was running on port 3001. Caddy was trying to reach it on port 30001.
An extra zero kept the public route broken after I had fixed the application’s startup. There were enough earlier failures that it was easy to keep looking at the application even after the remaining problem had moved elsewhere.

An unrelated address mix-up: the photographers note that this house was listed under the wrong street number. Hall-London House by Jerrye & Roy Klotz, MD, CC BY-SA 3.0; unmodified.
First, keep the application running
Traffic Diary is a Next.js application. Running it in a development terminal meant closing the terminal could stop the process. I built the app and set up a systemd service so its lifetime wouldn’t depend on keeping that terminal open.
The service had its own startup problems. An ExecStart path was missing its leading slash, and the process didn’t get the nvm-managed Node environment I had in an interactive shell.
Those were launch problems, like the MCP PATH failure. Correcting them got me far enough for the application to report its next problem: EADDRINUSE on port 3000.
Another service already occupied that port. I moved Traffic Diary to 3001 and got the service running there.
Then, check the proxy’s destination
Caddy still returned 502. Its upstream was:
127.0.0.1:30001
The application was listening on:
127.0.0.1:3001
The request path made the disagreement visible:
Browser -> Caddy -> 127.0.0.1:30001
X
Traffic Diary listener: 3001
Caddy didn’t need the application to restart on the same correct port again. It needed the correct port in its own configuration. I corrected the extra zero in the proxy configuration. The troubleshooting record ends there, so I treated that as the fix, without a recorded public-route retest.
An active service answers one question
The service manager can tell me that it has a running process. The application’s listener can show where that process accepts requests. The proxy configuration can show where Caddy sends them.
Those observations need to agree, but none replaces the others. Moving an app off an occupied port doesn’t update every reference to that port automatically.
I also need to test the public route after fixing the upstream. A local listener check is useful precisely because it isolates the application; it doesn’t exercise the browser-to-proxy-to-application path.
One character in the proxy configuration separated the working local application from the broken public site.