Free auditStart free
GuideError · CDN and hosting errors

Heroku H12: Request timeout

Heroku H12 means a request got no response data within 30 seconds. See the router log line, the 30 and 55 second windows, and fixes by stack and workload.

5 min
read
6
sources
Oct 31, 2026
updated
Scaplet Editorial Team
author
In one line

Heroku H12 means a request took longer than 30 seconds, so the router returned a 503 and logged code=H12 desc="Request timeout". The limit is measured by the router, including time queued inside the dyno. Your app keeps working on the request after the router gives up, so fix slow work, move it to a background job, or stream data to keep the connection alive.

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
01Check it

What the router measures

An HTTP request that takes longer than 30 seconds to complete produces H12. Heroku's documentation is precise about what counts: "This 30-second limit is measured by the router, and includes all time spent in the dyno, including the kernel's incoming connection queue and the app itself." A request that waits behind other requests inside a busy dyno spends its 30 seconds the same way as one stuck on a slow query.

Two things to read from that example. service=30001ms is the signature of H12. And the app logged Completed in 37000ms five seconds after the router had already answered 503. Heroku says the dyno "will continue to process the request, even though it won't be able to send any response", so a timed-out request still burns CPU and can slow the next one.

Heroku's H12 example: the router gives up, the app does not
2010-10-06T21:51:37-07:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=example-app-1234567890ab.herokuapp.com fwd=17.17.17.17 dyno=web.1 connect=6ms service=30001ms status=503 bytes=0
2010-10-06T21:51:42-07:00 app[web.2]: Completed in 37000ms (View: 27, DB: 21) | 200 OK [http://myapp.heroku.com/]
02Documented routing timeouts

The windows and limits that decide H12 versus its neighbours

Limit

Initial response window

Value
30 seconds
What happens past it
The web process must send response data (a full response or some bytes). Otherwise H12
Limit

Rolling window after the first byte

Value
55 seconds
What happens past it
Each byte sent or received resets it. With no data for 55 seconds the connection is terminated and H15 or H28 is logged
Limit

Total time to connect to a dyno

Value
75 seconds
What happens past it
The router retries connecting; if every dyno is quarantined for the full 75 seconds it answers 503 with H34
Limit

Router to dyno keep-alive idle timeout

Value
90 seconds
What happens past it
The router quietly closes the idle connection. A server idle timeout under 90 seconds can race with it and cause H18 or H13
Limit

Private Spaces, connection refused or timed out

Value
30 seconds
What happens past it
The router does not try another dyno and returns H12

The first row is the one most people hit. A response that has started streaming is governed by the 55 second window instead, which is how long-polling and server-sent events stay open on Heroku.

03How it works

Reproduce it and measure it

Time the request and watch the router
curl -sS -o /dev/null -w "%{http_code} %{time_total}s\n" https://your-app.herokuapp.com/slow-path
heroku logs --dyno router --tail
  1. 01

    Time the failing URL

    Run the curl below. A response that returns 503 after about 30 seconds matches H12. A 503 that returns instantly is H10 or H14.

  2. 02

    Confirm in the router log

    Run heroku logs --dyno router --tail and look for code=H12 with service=30001ms-style values.

  3. 03

    Find where the time goes

    In the app log lines for the same request, compare the Heroku example's View and DB figures, or your own timing logs, to see whether the wait is the database, an outside API or your code.

  4. 04

    Check for queueing

    If each request is fast alone but H12 appears under load, requests are queueing inside the dyno behind slow ones. Heroku suggests the New Relic add-on for visibility into request queue time.

04What Heroku documents for each cause

Fixes by cause

Cause

An infinite loop in the code

Fix
Reproduce locally, possibly with a copy of the production database, and fix the bug
Cause

Long work inside the web process: sending email, remote API calls, scraping, rendering an image or PDF, heavy computation, slow or N+1 database queries

Fix
Move it into a background job on a worker dyno and return immediately
Cause

An external service is slow or down

Fix
Set a timeout on outgoing HTTP requests and plan for the failure case, or move the call to the background
Cause

Large uploads on a slow connection take over 30 seconds

Fix
Upload directly to S3 instead of through the dyno
Cause

Requests queue behind a single-threaded server

Fix
Run more processes per dyno (Unicorn or Gunicorn), make slow requests faster, then add dynos
Procfile: Gunicorn with a worker timeout below the router's 30 seconds
web: gunicorn hello:app --timeout 10
config/unicorn.rb: Heroku's example
timeout 15

Heroku's guidance on lower server-side timeouts: Gunicorn restarts a worker that has not completed any work within 30 seconds by default, and with Unicorn the master sends SIGKILL to a worker after the timeout with no exception raised. The rack-timeout gem set below 30 seconds, for example 15, does raise an error, which makes the slow request far easier to trace. Note that Heroku lists a Unicorn timeout under 30 seconds, with a request still waiting for a worker, as one cause of H13.

Keep it in the request when
  • The slow part is one query you can index or one call you can cache
  • A user is waiting and a second or two of work can be made fast
  • You can stay under the 30 second window with margin
Move it to a worker when
  • It sends email, renders files or calls slow outside APIs
  • Its runtime varies with input size
  • The user can be shown a status page and polled
05Good to know

Streaming, long-polling and uploads

After the first byte, each byte resets a 55 second window. For server-sent events, detect when the client has hung up and close the connection promptly, because a connection held open for 55 seconds with no data ends in a timeout. If you cannot stream, send the first bytes early so the initial 30 seconds is satisfied.
06Explained

What H12 means for SEO

H12 is a 503 to the crawler. Google says 5xx and 429 responses "prompt Google's crawlers to temporarily slow down with crawling" and that indexed URLs are kept but "eventually dropped". Slow pages that sometimes cross 30 seconds are rarer than outright crashes, but they cost crawl rate the same way. See timeout errors and 5xx server errors for how to find the affected URLs.
Sources · 6

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • heroku.com
  • google.com
  • mozilla.org
  1. 01Heroku Dev Center: Heroku Error Codesdevcenter.heroku.com · checked 2026-11-01
  2. 02Heroku Dev Center: Request Timeoutdevcenter.heroku.com · checked 2026-11-01
  3. 03Heroku Dev Center: HTTP Routingdevcenter.heroku.com · checked 2026-11-01
  4. 04Heroku Dev Center: Deploying Python Applications with Gunicorndevcenter.heroku.com · checked 2026-11-01
  5. 05How HTTP status codes affect Google's crawlersdevelopers.google.com · checked 2026-11-01
  6. 06MDN: 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.

01How long is the Heroku request timeout?

The initial window is 30 seconds for the web process to return response data. After that, each byte sent or received resets a rolling 55 second window. Past 30 seconds with no data you get H12; past 55 seconds with no data mid-response you get H15 or H28.

02Can I increase the Heroku 30 second timeout?

Not through app settings. The limit is enforced by the router. Heroku's documented answers are to speed up the work, move it to a background job, upload large files directly to S3, or stream data so the rolling 55 second window applies.

03Why does my app keep running after an H12?

Heroku says the web dyno that was processing the request is left untouched and continues to process it even though it cannot send a response. Add a server-level or application-level timeout shorter than 30 seconds to stop runaway requests.

04Is H12 the same as a 504?

No. Heroku's router returns H12 with status=503. A 504 is the gateway timeout code in HTTP, so the meaning is close, but the status code your client and Google see is 503.

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