Edge Caching for Web Services
Serve static content from a global edge cache for faster delivery.
This feature is currently in early access.
To request access, upvote the feature request at feedback.render.com. We'll gradually roll out access to requesting workspaces over the coming weeks.
Render is introducing edge caching support for static assets (documents, images, etc.) served by paid web services. With edge caching enabled, you can speed up response times and reduce load on your web service:
Edge caching is powered by the same global CDN as Render static sites.
Setup
-
Request early access to this feature by upvoting the feature request at feedback.render.com.
- We'll gradually roll out access to requesting workspaces over the coming weeks.
-
After your workspace is added to early access, you can enable edge caching for any paid web service from its Settings page in the Render Dashboard.
How edge caching works
Whenever a client sends a GET or HEAD request to your cache-enabled web service, Render first checks its edge cache for the corresponding resource.
-
If the requested resource is in the cache (and the entry isn't stale), Render serves the cached version:
In this case, the request never reaches your web service. This speeds up the response and reduces load.
-
Otherwise, Render fetches the resource from your web service and caches it for future requests:
Cache invalidation
To help ensure that clients receive up-to-date content, Render automatically invalidates edge cache entries in the following scenarios:
Scenario | Description |
---|---|
New deploys |
Each time you deploy a new version of your web service, Render purges all of its associated edge cache entries. This way, your deployed changes are reflected to clients as soon as possible. |
TTL expiration |
Each cache entry has a corresponding time-to-live (TTL). When an entry's TTL expires, the entry is considered stale. The next request for a stale entry is sent to your web service, which refreshes the entry. |
Cache defaults
By default, Render caches static assets with the following file extensions (you can customize this by setting cache control headers in your service's responses):
7z
avi
avif
bin
bmp
bz2
class
css
csv
dmg
doc
docx
eot
ejs
eps
exe
flac
gif
gz
ico
iso
jar
jpeg
jpg
js
mid
midi
mkv
mp3
mp4
ogg
otf
pdf
pict
pls
png
ppt
pptx
ps
rar
svg
svgz
swf
tar
tif
tiff
ttf
webm
webp
woff
woff2
xls
xlsx
zip
zst
The default TTL for a cached asset is 120 minutes.
Render only caches assets returned for GET
and HEAD
requests. Render does not cache an asset if the response includes a Set-Cookie
header.
Customizing cache behavior
You can customize Render's edge caching behavior for a particular resource by including a Cache-Control
(or CDN-Cache-Control
) header in your web service's response:
Cache-Control: public, max-age=7200
New to cache control headers?
Learn more about the response directives mentioned in the table below.
Customization | Description |
---|---|
Enable caching / Change TTL |
Do both of the following in your response's cache control header:
http
|
Disable caching |
Do either of the following in your response's cache control header:
http
|
Set revalidation behavior |
Include a combination of the http
|
Customization precedence
Render applies the following precedence rules to cache control headers:
- The
CDN-Cache-Control
header takes precedence over theCache-Control
header. - The
s-maxage
directive takes precedence over themax-age
directive.