← BLOG

No open ports detected: bind to 0.0.0.0 and PORT

A deployed web app usually shows "no open ports detected" because it listens only on localhost or ignores the port assigned by the host. Bind to 0.0.0.0 and read PORT from the environment.

RUNNING APPS · 20 AUGUST 2026 · 5 MIN READ

Fix "no open ports detected" by making the HTTP server listen on host 0.0.0.0 and the port supplied in the PORT environment variable. Localhost and 127.0.0.1 accept traffic only from inside the same container. A hosting proxy cannot reach that loopback address.

The process can be healthy while the site is unreachable. This is a networking contract, not necessarily an application crash.

Two values must be right at the same time

SETTINGLOCAL VALUE THAT OFTEN FAILSDEPLOYMENT VALUE
Host interfacelocalhost or 127.0.0.10.0.0.0
PortA hardcoded 3000, 5000, or 8000The value in PORT

Binding to 0.0.0.0 does not publish the container directly to the internet. It lets the platform proxy reach the process on the container network. The proxy normally accepts public HTTPS, terminates TLS, and forwards the request to your HTTP listener.

Working Node and Python examples

JS
const port = Number(process.env.PORT) || 3000;

app.listen(port, '0.0.0.0', () => {
  console.log(`listening on 0.0.0.0:${port}`);
});
Express reads the assigned port and listens on every container interface.
PYTHON
import os
import uvicorn

port = int(os.environ.get("PORT", "8000"))
uvicorn.run(app, host="0.0.0.0", port=port)
The equivalent Uvicorn start inside a Python entry point.

The fallback keeps local development convenient. In production, the host-provided PORT wins. Do not copy one provider's default port into the code and assume every environment uses it.

Read the first symptom, not the final error page

SYMPTOMLIKELY CAUSENEXT CHECK
No open ports detectedNothing is listening where the scanner expectsPrint the host and port at startup
502 Bad Gateway with a running processProxy cannot reach the listenerCheck 0.0.0.0, PORT, and startup completion
Connection refusedProcess exited or never opened the socketRead the first runtime error
EADDRINUSE or address already in useTwo servers chose the same portStart one HTTP listener, not one per module
Health check times outRoute is slow, blocked, or never returns successCreate a small endpoint with no database dependency

Reproduce the hosting contract locally

  1. 01
    Use the real start commandRun the same npm script, Uvicorn command, or entry file configured for the deployment.
  2. 02
    Set a temporary PORTStart with PORT=10000 or another unused local port so hardcoded values become visible.
  3. 03
    Print the listener addressThe startup line should name 0.0.0.0 and the value you supplied.
  4. 04
    Call a small routeUse curl against localhost on that port. A plain health response separates networking from database or frontend errors.
  5. 05
    Redeploy and read the earliest linesLater proxy errors are consequences. The startup log usually contains the cause.

Common fixes that create a second problem

  • Do not bind directly to port 443. The platform proxy owns public HTTPS.
  • Do not set PORT to a domain name or full URL. It is an integer.
  • Do not open a second server only for health checks. Put the health route on the existing app.
  • Do not use a development server in production when the framework provides a production start command.
  • Do not treat 0.0.0.0 as a browser address. Visit the public host URL or localhost during local testing.

Spocket assigns PORT to HTTP apps and routes an HTTPS spocket.dev address to that listener. Use /documentation/domains-and-webhooks for the exact contract and /documentation/logs-and-status for startup output. Static exports do not need a listener, so /run/sites also helps confirm whether the project is a static site or a server app.

Need somewhere to put it?

Spocket runs apps, workers and scrapers that have to stay awake. Deploy from Claude or Cursor by asking, from $3/mo. First app is free for 7 days, no card.

Deploy a web appRead the quickstart
Spocket
BlogDocsTermsPrivacyHome