Introduction:
We’re excited to announce public beta support for HTTP/2 on both Heroku Common Runtime and Private Spaces. HTTP/2 support is one of the most requested and desired improvements for the Heroku platform. HTTP/2 is significantly faster than HTTP 1.1 by introducing features like multiplexing and header compression to reduce latency and therefore improve the end-user experience of Heroku apps.
Since 2023, we’ve been working on a large platform modernization of our Common Runtime router. This project will allow us to start delivering more modern networking for Heroku. With the majority of that work now complete, we’re excited to focus more on the future and new features.
What Do You Get From HTTP/2?
Upgrading to HTTP/2, the next-generation HTTP protocol, significantly improves web app performance for our customers. Here's how:
Faster loading times: HTTP/2 uses header compression and multiplexing to deliver content quicker and more efficiently. This improvement translates to faster page loads, especially for content-heavy applications with many images or videos.
Enhanced responsiveness: HTTP/2 lets multiple requests travel simultaneously on a single connection, and stream prioritization ensures smoother communication and faster updates. HTTP/2 reduces latency and improves performance for real-time applications like chat or live collaborative tools.
Improved user experience: Streamlined data transfer and reduced waiting times lead to a more enjoyable user experience. Users experience smoother scrolling, faster interactions with forms, and an overall improved sense of responsiveness across Heroku applications.
HTTP/2 terminates at the Heroku router and we forward HTTP/1.1 from the router to your app. This method is great because you get most of the benefits of HTTP/2 without having to make any changes to your app or code.
Along with this beta, we’ll continue to research solutions to provide HTTP/2 end-to-end (all the way to the dyno) and enable features like Server Push and gRPC use cases with Heroku apps. Those capabilities aren’t included in this release.
For more information about HTTP/2, you can refer to the official HTTP/2 RFC (RFC 9113).
How to Turn On HTTP/2 For Your Application
A valid TLS certificate is required for HTTP/2. We recommend using Heroku Automated Certificate Management.
Common Runtime Applications
For Common Runtime apps, if you’re in the Routing 2.0 Public Beta, HTTP/2 is on by default. If you’re not in the beta, you can enable it with this command:
$ heroku labs:enable http-routing-2-dot-0 -a <app name>
After enabling the new router for your app, it can handle HTTP/2 traffic. In the Common Runtime, we support HTTP/2 on custom domains, but not on the built-in <app-name-cff7f1443a49>.herokuapp.com
domain.
To opt out of HTTP/2, simply disable the new router on your application.
Private and Shield Spaces Applications
For Private and Shield Spaces apps, you can enable HTTP/2 for an app with a Heroku Labs flag:
$ heroku labs:enable spaces-http2 -a <app name>
In Private Spaces, we support HTTP/2 on both custom domains and the built-in default app domain.
To disable HTTP/2, simply disable the Heroku labs spaces-http2
flag on your app.
Conclusion
We’re excited to finally bring HTTP/2 to the Heroku platform to see how it improves our customers' apps and their users’ experience.
HTTP/2 is currently in public beta. When our new router becomes the default on Common Runtime, the feature will become generally available for all Heroku customers.
We want to express our sincere appreciation for the feedback received on the Heroku Public roadmap request that led to this change. Your insights were instrumental in shaping this first release of features on our next-generation router. We'll continue monitoring the public roadmap and your feedback as we explore future networking and routing enhancements, especially our continued research on expanding HTTP/2 functionality to dynos and exploring HTTP/3.