Is there a way to setup CDN cache rules?


Totally new to Render, I’m running a node web service, a stripe headless cms and a db related to.

I am wondering if there is a way to setup CDN cache rules for node web service, to only allow cache static images, so that I can allow my website update immediately when stripe content update?

Much appreciated your response.

Hi, we use Fastly CDN in our infrastructure. As far as I know, the CDN config is not managed at the user level.

Fastly, like most CDNs respects the various HTTP headers. Depending on your specific requirements, you can modify either your webapp or your static site configuration (on the dashboard) to modify the policy. Maybe that can get you somewhere without full control over the CDN.

From what I can tell (I am new to render myself), the headers can only be configured by path on static sites so this part will only work if your static assets are in a specific location.

As you mentioned rules for the node web service, you will have more flexibility in your app for controlling cache behaviour by type, path, etc…

A word of caution, ‘immediately’ is not really achievable and ‘almost immediately’ usually comes at a high price in terms latency, server load, cost (in the money sense), etc…

1 Like

Thank you, I am doing SSR project, and I did change in two areas:

  1. Wrap the fetch response with a specific cache header.
  2. Add different cache control headers to different html page.

Much appreciated your response.