HTTP Caching
Last updated July 13, 2024
Table of Contents
Effective HTTP caching can make an application more responsive while decreasing load on the app’s dynos. This article discusses the motivation for HTTP caching and shows how you can use it in your apps.
Use cases
HTTP caching can decrease the time it takes to load a web page and its assets, as well as reducing the load on your app’s web dynos.
In general HTTP caching is most applicable to production sites with moderate to high levels of traffic, especially those serving static assets.
Enabling HTTP caching
Heroku doesn’t provide HTTP caching by default. In order to take advantage of HTTP caching, you’ll need to configure your application to set the appropriate HTTP cache control headers and use a content delivery network (CDN) or other external caching service.
See this article for an in-depth explanation of HTTP cache control headers. There are several options available for external caching services, including Amazon CloudFront and CloudFlare.