|
| 1 | +--- |
| 2 | +title: Bad Gateway Error |
| 3 | +--- |
| 4 | + |
| 5 | +# Bad Gateway Error |
| 6 | +If your deployed application works when you access it via your server’s IP address and port but shows a **Bad Gateway** error on your domain, the issue is most often due to misconfigured port settings, incorrect host mapping, or your app listening only on localhost. |
| 7 | + |
| 8 | + |
| 9 | +## Symptoms |
| 10 | +- The application is accessible via the server IP with a port but not via the domain. |
| 11 | +- You might also run into a **No Available Server** error. |
| 12 | + |
| 13 | + |
| 14 | +## Diagnosis |
| 15 | +- **Port Configuration:** Check the port your application is listening on and see if the correct port is entered in the **Port Expose** field on the Coolify dashboard. |
| 16 | + |
| 17 | +- **Host Mapping:** Check if the application’s port is mapped to the host system. |
| 18 | + |
| 19 | +- **Listening Address:** Check if the app is only listening to `localhost` inside the container. |
| 20 | + |
| 21 | +- **Domain Port Inclusion:** Check your domain URL has a port number at the end. |
| 22 | + |
| 23 | +- **Container Status:** Check the status of the container where your app is running (Is it unhealthy? Stuck at Starting?). |
| 24 | + |
| 25 | + |
| 26 | +## Solution |
| 27 | +- **Update Port Settings:** Enter the correct port number in the **Port Expose** field on the Coolify dashboard and restart your app. |
| 28 | + |
| 29 | + <ZoomableImage src="/docs/images/troubleshoot/applications/bad-gateway/1.webp" /> |
| 30 | +- **Remove Host Port Mapping:** If the port is mapped to the host system, remove the mapping so the proxy can route traffic correctly, then restart your app. |
| 31 | + |
| 32 | + <ZoomableImage src="/docs/images/troubleshoot/applications/bad-gateway/2.webp" /> |
| 33 | +- **Adjust Listening Address:** Change your application so it listens on all network interfaces (`0.0.0.0`) instead of just `localhost`. |
| 34 | + |
| 35 | + <ZoomableImage src="/docs/images/troubleshoot/applications/bad-gateway/3.webp" /> |
| 36 | +- **Correct Domain URL:** Add the correct port number at the end of your domain URL if needed, and restart your application. |
| 37 | + |
| 38 | + <ZoomableImage src="/docs/images/troubleshoot/applications/bad-gateway/4.webp" /> |
| 39 | +- **Restart Container / Check Logs:** Try restarting the container to see if it fixes the issue, or check the container logs to find out what's causing it to be unhealthy. |
| 40 | + - Often, a failing health check might be the problem, and removing the health check could fix it. |
| 41 | + |
| 42 | + <ZoomableImage src="/docs/images/troubleshoot/applications/bad-gateway/5.webp" /> |
| 43 | + |
| 44 | + |
| 45 | +## Support |
| 46 | +If these steps don’t solve the issue, consider reaching out for further assistance by joining our [Discord community ↗](https://coolify.io/discord) and sharing your app logs, coolify proxy logs, configuration screenshots, and details of the troubleshooting steps you’ve already tried. |
0 commit comments