PortGate

Resources · Port reference · port 3000

Port 3000 (development servers): what it is and how to secure it

Grafana, Node.js, Next.js, Rails and Gitea default to port 3000, and many bind every interface. Put a reverse proxy in front and bind the app to 127.0.0.1.

Check command

sudo ss -tlnp | grep ':3000 '

Copied.

Port 3000 is where Node.js apps, Next.js, Rails, Grafana and Gitea listen by default. In production, the app should listen on 127.0.0.1:3000 and nginx or Caddy should serve it to the world on 443 with HTTPS.

What port 3000 is for

It is a convention, not a standard. npm start, next start, rails server and Express examples all pick 3000. Grafana and Gitea use it for their web interfaces.

Why an open 3000 is risky

  • Development servers in production. next dev, vite --host or Rails in development mode show detailed errors, source paths and sometimes environment details. They are not built to face the internet.
  • Admin interfaces. Grafana's first login is admin / admin until someone changes it, and dashboards can reveal internal hostnames and data sources.
  • No HTTPS. Anything on 3000 is plain HTTP, including cookies and logins.
  • Bypassing your proxy. If nginx adds rate limits, headers or authentication, a public 3000 lets people skip all of it.

Check yours

sudo ss -tlnp | grep ':3000 '

*:3000, 0.0.0.0:3000 or [::]:3000 is public. From another machine:

curl -sI --max-time 5 http://YOUR_SERVER_IP:3000

Fix it

Bind the app to loopback. The setting depends on the app:

App Setting
Node / Express app.listen(3000, '127.0.0.1')
Next.js next start -H 127.0.0.1 -p 3000
Rails (Puma) bind "tcp://127.0.0.1:3000" in config/puma.rb
Grafana http_addr = 127.0.0.1 under [server] in grafana.ini
Docker ports: ["127.0.0.1:3000:3000"]

Restart the app, then proxy it:

location / {
    proxy_pass http://127.0.0.1:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

The Upgrade lines keep WebSockets working for apps that use them.

If you run Grafana, change the admin password now, and turn off anonymous access unless you meant it.

Common mistakes

  • Running npm run dev under PM2 on the server. Build and run the production server instead.
  • HOST=0.0.0.0 copied from a Docker guide onto a server with a public IP.
  • Closing 3000 in UFW while Docker publishes it. Docker's rules come first; bind to 127.0.0.1 instead.

FAQ

Is it OK to open port 3000 for a quick demo? For minutes, behind a strong password, maybe. A tunnel such as ssh -L 3000:localhost:3000 you@server is safer and just as quick.

How do I get warned? PortGate's Server Guard alerts when a new port, 3000 included, starts answering on a public address.