Dokku app redirecting to wrong host

June 14, 2023

I recently had a problem with a dokku app that was redirecting to the wrong host...

When attempting to access the site with the browser I got an https error Did Not Connect: Potential Security Issue with an Error code: SSL_ERROR_BAD_CERT_DOMAIN.

Attempting connect using curl also failed:

curl: (7) Failed to connect to app.example.com port 80 after 70 ms: Connection refused

The error is because it was redirecting to the global site instead of the vhost... but the app has a startup check that ensures it was loading and the container was running so what gives?

It turns out the first deploy failed which caused something to break with the apps reverse proxy config. The fix was found in dokku's proxy-management docs.

A simple rebuild the proxy config:

dokku proxy:build-config <app>

Now it works again!