Router 2.0 (Public Beta)
Last updated August 27, 2024
Table of Contents
The beta release for Heroku’s new Common Runtime router, Router 2.0, gives customers an early opportunity to experiment and provide feedback to shape the future of our networking product. You can opt into the beta by following the instructions here.
This new router is specific to Eco, Basic, Standard, and Performance dynos in the Heroku’s Common Runtime. This feature isn’t available for Private or Shield dynos in Private Spaces.
As an early adopter, you can help us validate that things are working as they should, particularly for your apps and use cases. The current Common Runtime production router won’t receive new features going forward. See the table to see what these new features are.
If you participate in the beta, you can submit feedback by commenting on the Heroku Public Roadmap item or by creating a support ticket.
This feature is in public beta and is subject to change. Use of this feature is subject to the Beta Services terms.
Router 2.0 is a Heroku Labs feature. Heroku SLAs as covered in the Heroku Support Policy don’t apply. Support tickets related to this beta are considered product feedback.
Current and Future State
As we develop the new router, we plan to continue adding the features in the following table to reach parity with our current Common Runtime router.
Features added through Heroku Labs are experimental and subject to change.
The new router supports the following features:
Feature | Current Common Runtime Router | Router 2.0 | Notes |
---|---|---|---|
Routing | x | x | Basic routing, including TLS termination is supported. |
Router logs | x | x | Per-request router logs appear in your app’s log stream. |
Error codes | x | x | Most H codes are supported and reported in router logs. Currently, the only exceptions are H23 and H26. |
Dyno sleeping | x | x | Dyno sleeping (idling) is supported for Eco dynos. |
Request concurrency limiting | x | x | Each router maintains an internal per-app request counter and limits the number of concurrent requests per app. |
Heroku headers | x | x | Heroku Headers are a set of headers that Heroku adds to HTTP responses. |
WebSockets | x | x | WebSockets protocol is supported by the new router. |
Expect 100-continue | x | x | The Expect: 100-continue header is supported by the new router. See enabling support for 100-continue for more details |
Dyno quarantining | x | x | The router quarantines unreachable dynos. |
Preboot | x | x | Preboot release behavior works with the new router. |
Session affinity | x | x | Associates all HTTP requests coming from an end-user with a web dyno |
HTTP/2 | x | HTTP/2 is available for Router 2.0 only. | |
IPV6 | Coming soon for Router 2.0 only |
For a full list of HTTP routing features of our current Common Runtime router, see HTTP Routing.
We update this table and announce new features in our changelog as we add them to the new router.
Enable Router 2.0
To opt in to using the new router, enable the Heroku Labs feature:
$ heroku labs:enable http-routing-2-dot-0 -a <app name>
After enabling this feature, your app starts to receive traffic through Router 2.0, our new Common Runtime router.
Clients must re-establish their connection to your app after enabling or disabling the http-routing-2-dot-0
flag.
Disable Router 2.0
To stop using the new router, disable the http-routing-2-dot-0
flag. You don’t need to do anything else to return your app to its previous routing behavior.
To stop using Router 2.0:
$ heroku labs:disable http-routing-2-dot-0 -a <app name>
HTTP/2 with Router 2.0
For Common Runtime apps, if you enabled Router 2.0, HTTP/2 is on by default. Note the following feature considerations for HTTP/2 on the Common Runtime:
HTTP/2 terminates at the Heroku router and we forward HTTP/1.1 from the router to your app.
Specifically for the Common Runtime, we support HTTP/2 on custom domains, but not on the built-in
<app-name-cff7f1443a49>.herokuapp.com
domain.A valid TLS certificate is required for HTTP/2. We recommend using Heroku Automated Certificate Management.
You can verify your app is receiving HTTP/2 requests by referencing the protocol
value in your Heroku Router Logs.
To opt out of HTTP/2, disable the new router on your application.
Router Logs with Router 2.0
With Router 2.0 enabled on your Common Runtime app, heroku[router]
logs take a slightly different format. This new format provides more information on HTTP and TLS versions used by clients. The below fields are different in Router 2.0:
protocol
: indicates the request protocol, including the HTTP version. Possible values arehttp1.1
andhttp2.0
.tls
: indicates whether TLS is in use on the connection. Possible values aretrue
andfalse
.tls_version
: indicates the TLS version used on the connection. Possible values aretls1.2
,tls1.3
orunknown
. Note thatunknown
is the value for all TLS connections on the defaultherokuapp.com
domain.
Here is an example of a log line in the new and improved format:
2024-04-26T16:58:32.943253+00:00 heroku[router]: at=info method=GET path="/" host=my-app.example.com request_id=6903a168-b79b-ec27-03c8-b8f64d8d8792 fwd=138.68.186.89 dyno=web.1 connect=0ms service=0ms status=200 bytes=0 protocol=http2.0 tls=true tls_version=tls1.3
For comparison, see the non-Router 2.0 log format.