Free auditStart free
GuideError · CDN and hosting errors

Heroku H13: Connection closed without response

Heroku H13 means your dyno accepted a connection and closed it without writing a response. Learn the keep-alive race, Unicorn timeout cause and per-server fixes.

5 min
read
9
sources
Oct 30, 2026
updated
Scaplet Editorial Team
author
In one line

Heroku H13 means a process in your web dyno accepted a connection and then closed the socket without writing anything, so the router returned a 503. The two documented causes are a server timeout shorter than 30 seconds that fires before a worker handles the request, and a keep-alive idle timeout under 90 seconds that races the router.

30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
02Check it

Cause 1: your server's timeout fires first

Heroku's example: a Unicorn web server "configured with a timeout shorter than 30s" where "a request has not been processed by a worker before the timeout happens". Unicorn closes the connection before any data is written, which is an H13. The router limit is 30 seconds; a shorter server limit means the server cuts the connection and the router sees a socket with nothing on it.

The same article warns that with Unicorn or Gunicorn, your main worker can time out and kill web workers. Gunicorn restarts a worker that has not completed any work within the last 30 seconds by default, and Heroku's Gunicorn guide shows --timeout for lowering it. If requests queue behind slow ones, workers hit that timeout while requests wait. Fix the slow request, add worker processes, or tune the timeout deliberately.

Procfile: Gunicorn timeout, Heroku's example value
web: gunicorn hello:app --timeout 10
03Fix it on your stack

Cause 2: the keep-alive race with the router

Heroku's routers keep a pool of connections to your dynos. An idle pooled connection is closed by the router after 90 seconds, quietly, with no error code. Heroku's warning: if your server's idle timeout is under 90 seconds, "this may introduce a race condition between the router sending a request and the dyno's server closing a stale connection", which "can lead to H18: Server Request Interrupted or H13: Connection closed without response errors."
Node.js: keep connections open longer than the router does
const server = app.listen(process.env.PORT);
// milliseconds; Heroku recommends 90 seconds or greater
server.keepAliveTimeout = 95 * 1000;
config/puma.rb
persistent_timeout 95
Procfile: Gunicorn
web: gunicorn hello:app --keep-alive 95

The recommendation is to set server idle connection timeouts to 90 seconds or greater so the router initiates the close. The defaults of common servers are below that, which is why this shows up as sporadic H13s on an otherwise healthy app.

Default idle or keep-alive settings against the 90 second router timeout
ServerSettingDefaultSafe for Heroku as is?
Node.js httpserver.keepAliveTimeout5000 ms (5 seconds)No - raise it above 90 seconds
Pumapersistent_timeout65 secondsNo - raise it to 90 or more
Gunicorn--keep-alive2 secondsNo - raise it, or confirm your worker class

Gunicorn's keepalive setting is described as "the number of seconds to wait for requests on a Keep-Alive connection". Check that your worker class honors it before relying on it. Node's server.keepAliveTimeout is documented as milliseconds of inactivity before a socket is destroyed, with a server.keepAliveTimeoutBuffer added on top.

04How it works

Work out which cause you have

Raise the idle timeout when
  • H13s are sporadic and quick
  • Your server's keep-alive default is under 90 seconds
  • The app is otherwise healthy
Disable keep-alive to the dyno when
  • You cannot change the server's idle timeout
  • You are on a Cedar-generation app (Heroku says it cannot be disabled on Fir)
  • You accept losing connection reuse between router and dyno
  1. 01

    Pull the H13 lines

    Run heroku logs --dyno router --tail and note the connect and service values on each H13. Compare them with your server's timeout and keep-alive settings.

  2. 02

    Look at the app log at the same time

    Run heroku logs --source app --tail and check for the server's own timeout or worker-killed message at the same timestamp.

  3. 03

    Compare your server's idle timeout with 90 seconds

    If it is lower, apply the table above first. It is a one-line change.

  4. 04

    Run more than one process per dyno

    Heroku's request-timeout article lists Unicorn or Gunicorn with more worker processes as the most effective way to improve queueing inside a dyno.

05Good to know

What H13 means for crawlers

Because H13 is returned as a 503, Google treats it as a server error: crawlers "temporarily slow down with crawling", and indexed URLs are kept but "eventually dropped" if errors persist. Sporadic H13s are less damaging than steady ones, but a crawler is one of the clients that holds connections, so fix the keep-alive race rather than waiting it out. See 5xx server errors.
Sources · 9

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • heroku.com
  • nodejs.org
  • githubusercontent.com
  • google.com
  • mozilla.org
  1. 01Heroku Dev Center: Heroku Error Codesdevcenter.heroku.com · checked 2026-11-01
  2. 02Heroku Dev Center: HTTP Routingdevcenter.heroku.com · checked 2026-11-01
  3. 03Heroku Dev Center: Request Timeoutdevcenter.heroku.com · checked 2026-11-01
  4. 04Heroku Dev Center: Deploying Python Applications with Gunicorndevcenter.heroku.com · checked 2026-11-01
  5. 05Node.js: HTTP, server.keepAliveTimeoutnodejs.org · checked 2026-11-01
  6. 06Gunicorn source: config.py (Keepalive setting)raw.githubusercontent.com · checked 2026-11-01
  7. 07Puma source: lib/puma/dsl.rb (persistent_timeout)raw.githubusercontent.com · checked 2026-11-01
  8. 08How HTTP status codes affect Google's crawlersdevelopers.google.com · checked 2026-11-01
  9. 09MDN: 503 Service Unavailabledeveloper.mozilla.org · checked 2026-11-01
Questions

Asked a lot.

4 questions people ask next, answered from the sources on this page.

01What causes Heroku H13?

A process in the web dyno accepted a connection and closed the socket without writing a response. Heroku names a server timeout shorter than 30 seconds, such as Unicorn's, and a keep-alive idle timeout shorter than the router's 90 seconds as the documented causes.

02Why do I get random H13 errors on a healthy app?

Likely the keep-alive race. The router closes idle pooled connections after 90 seconds, and a server with a shorter idle timeout may close the same connection while the router sends a request on it. Raise the server idle timeout to 90 seconds or more.

03Is H13 my application's fault?

It starts in the dyno, so the fix is in your server or app configuration, not on Heroku's side. Check your server's timeout and keep-alive settings and look for workers being killed.

04What is the difference between H13 and H18?

H13 is a socket that closed with nothing written. H18 is a socket that connected and sent some data but was destroyed before a complete response, or a server that responded before reading the whole request body.

Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane