Home › Web & HTTP

ERR_EMPTY_RESPONSE — how to fix

This page isn't working
localhost didn't send any data.
ERR_EMPTY_RESPONSE

Quick fix: Reproduce with curl -v http://host:port/ (it shows Empty reply from server). Check the server logs for a crash on that request. Make sure you use the right scheme for the port (http vs https). In Docker, make the app listen on 0.0.0.0 instead of 127.0.0.1. Make sure every route handler sends a response.

What it means

The TCP connection worked, which is why this isn't ERR_CONNECTION_REFUSED. But the server closed it without sending a single byte of HTTP response. curl reports the same situation as:

curl: (52) Empty reply from server

Always reproduce it with curl first, because it removes browser cache, extensions and HSTS from the picture:

curl -v http://localhost:3000/
curl -vk https://localhost:3000/

Cause 1: the server crashes or exits while handling the request

If the process dies (unhandled exception, segfault, out of memory) or a worker is killed in the middle of a request, the socket closes empty.

Fix: watch the logs while you reload:

docker logs -f <container>        # containers
journalctl -u myapp -f            # systemd services

Look for a stack trace, Killed (out of memory), or the process restarting. Fix the crash. For a memory kill, give the process more memory or reduce what that request loads.

Cause 2: wrong protocol for the port

Sending plain HTTP to a port that expects TLS (or the other way round) often ends with the server closing the connection without a response.

Fix: use the scheme the server is configured for: http://localhost:8080 vs https://localhost:8443. If the browser keeps upgrading http:// to https:// for that host, that's HSTS: test in a private window or with curl.

Cause 3: Docker port is published but the app listens on 127.0.0.1

Inside a container, 127.0.0.1 is the container's own loopback. With -p 8080:8080 the connection reaches the container, but nothing listens on the container's external interface, so it's closed. Depending on the platform this shows as an empty response or a connection reset.

Fix: bind to all interfaces inside the container:

# Flask
flask run --host=0.0.0.0
# Vite
vite --host 0.0.0.0
# Node http
server.listen(8080, '0.0.0.0')

Check what the app listens on: docker exec <container> ss -ltnp (if ss exists in the image).

Cause 4: a handler never writes a response or ends the connection badly

Code that closes or destroys the socket on error, or a server that drops requests it can't parse (for example oversized headers or cookies), gives an empty reply.

Fix: make every code path send a response, including errors:

app.get('/report', async (req, res, next) => {
  try {
    res.json(await buildReport());
  } catch (err) {
    next(err);            // let Express send a 500 instead of dropping the socket
  }
});

If the request has a very large cookie, clear the site's cookies and try again.

Cause 5: proxy, load balancer, antivirus or VPN in between

A reverse proxy whose upstream closed the connection, an idle timeout on a load balancer, or antivirus "web shield" HTTPS scanning can all cut the response. Test from another network or with the VPN/antivirus web protection turned off. For nginx, check /var/log/nginx/error.log for upstream prematurely closed connection.

Last updated 2026-12-04.