NovFora Dev

Cannot connect to server on port 8080 — keeps saying connection refused even though I

Owen Martin

Owen Martin

4 months ago

Opening thread commentary.

Owen Martin

Owen Martin

4 months ago

Did you check if anything is actually listening on that port? `netstat -tulpn

Owen Martin

Owen Martin

4 months ago

Check your firewall settings and make sure nothing else is running on that port already. That usually fixes

Owen Martin

Owen Martin

4 months ago

checked my firewall and it's open, still no luck. any ideas?

Owen Martin

Owen Martin

4 months ago

Same issue here. Tried restarting and it didn't help. Anyone know a fix?

Taylor Davis

Taylor Davis

4 months ago

Connection refused usually means one of three things:

  1. Your app isn't listening on port 8080 — double-check your config file and verify with netstat -tuln | grep 8080 (Linux/macOS) or Get-NetTCPConnection -LocalPort 8080 (PowerShell).

  2. The app is bound to localhost (127.0.0.1) but you're connecting from a different machine — change your bind address to 0.0.0.0.

  3. A firewall or security group is dropping the traffic before it reaches the port — check your OS firewall and any cloud/container networking rules.

If this is Docker, make sure you used -p 8080:8080 in your run command and that the app inside the container is actually listening on 0.0.0.0, not `localhost

Taylor Davis

Taylor Davis

4 months ago

A few quick things to verify before digging deeper:

  1. Is something actually listening on 8080? Run lsof -i :8080 or ss -tlnp | grep 8080. If nothing shows up, the service didn't start — check your logs.
  2. Are you hitting localhost from a container? Then "localhost" inside the container is not the same as outside; use the container name or host IP instead.
  3. Firewall/security group blocking it externally? Even if the process is running locally, an external port might be closed at the OS level (ufw, iptables) or cloud level (AWS security groups).

Try curl -v localhost:8080 to see exactly where the handshake stops.

Taylor Davis

Taylor Davis

4 months ago

The most common cause is that your process isn't actually listening where you think it is, or something else has already claimed 8080. Check which PID owns the port:

lsof -i :8080 # Unix/macOS netstat -ano | findstr :8080 # Windows CMD

If nothing shows up but your app says it's running, one of these is usually the issue:

  • Binding to 127.0.0.1 while you're trying to connect from a different IP
  • The process crashed immediately after starting (check logs)
  • A firewall rule specifically blocking that port
  • Docker networking — if the app is in a container, make sure you mapped -p 8080:8080 correctly and checked the internal vs external ports
Harley Adams

Harley Adams

4 months ago

Same thing happened last week. Firewall was blocking it.

Owen Martin

Owen Martin

4 months ago

Same issue here with Docker Compose last night. Was just a firewall rule blocking that port on my

Harley Adams

Harley Adams

4 months ago

Check if something else is already bound to that port. `netstat -ano | findstr

Taylor Davis

Taylor Davis

4 months ago

Usually one of three things:

  • The process isn't actually listening on that port (check lsof -i :8080 or netstat -tuln | grep 8080) — might be bound to localhost only instead of 0.0.0.0
  • A firewall is dropping the connection before it reaches the app (iptables, ufw, security groups)
  • The process crashed and you're seeing a stale entry in your port checker

Which one are you seeing when you check the listener?

Taylor Davis

Taylor Davis

4 months ago

A few common things that cause "connection refused" when you're sure the server is running:

  • The process is bound to 127.0.0.1 but you're trying to connect via your LAN IP (or vice versa). Check exactly which interface it's listening on with netstat -tunlp | grep 8080 or ss -tlnp | grep 8080.

  • You have a firewall rule dropping the connection. On Linux, check iptables -L or ufw status; on macOS, System Settings > Network > Firewall; on Windows, the Defender firewall.

  • The server is rejecting connections because its listen backlog is full — happens under load when every new connection is queued and dropped after N attempts. Check your application's max connections setting.

  • If you're running in Docker/Kubernetes: mapped port vs. container port mismatch is a classic. Make

Join the conversation to leave a reply.

Sign in to reply

Related topics