Config for


Is the config for public?

We had an interesting conversation at about the varnish config for discourse. The community does not support a varnish config for dynamic content. So curious about how it is implemented here and if the config is open to the public.


Hi Quintin,

The configuration for this website is very minimal: we use the default configuration of caching according to the Cache-Control headers sent by the origin. As mentioned in meta, this means caching the static assets and everything else passes through to the origin.

It might be possible to cache the content too and invalidate pages upon updates, but that would require changing Discourse. We do something similar with our Fastly Drupal and WordPress extensions.

HTH, Léon


I am a bit confused.

  1. So does that mean even if this forum webserver goes down, theoretically all the pages will be served from Fastly, even if it’s read only? Discourse’ co-founder mentions the pages are all set ‘private’ Do you override this?
  2. If this is all going through the origin and respects Cache-Control, that means theoretically you are CDNing only the static assets, all the rest are just going through the origin without being cached.

My intention here is to run my discourse forum on Fastly and as a result wanted to take a look under the hood for the config.



If our discourse server were to go down, based on our current cache configuration, the site would be unreachable. As Leon says, it would be feasible to make Discourse ‘fastly aware’ so it could send purges when threads were updated, as we have done for Wordpress and Drupal.


Thanks Andrew.
It would be awesome if Fastly owns up the varnish config for Discourse. A plugin-play solution for Discourse and you’ll get all the discourse customers :slight_smile:


@triblondon I’m also planning to use Fastly’s site shield for my discourse site.
I’m working on the setup right now, and was very surprised to find you wrote:

If your would go down even with Fastly’s site shield configuration… How would you compare under a traffic surge to not using site shield?

How would that look from perspective of end users of


I believe per Leon’s earlier comment, we are not using shielding for our discourse site. Also, by default Discourse does not allow pages to be edge cached so there is no benefit to shielding, unless you wish to reduce the origin traffic for static assets, or you modify the Discourse caching behaviour.


Funny, that’s the exact opposite of what they posted about this on Discourse’s own forum… :wink:


You can see why I would be confused.

Discourse seems to be growing, and recommends Fastly. You even use it for your own forum. Whatever you can do to make the process easier for users would be appreciated. Some things that come to mind:

  • More direct, concise, clear documentation (without so many links… DRY don’t apply to documentation)
  • Performance metrics: Discourse alone, Discourse + Fastly, Discourse + Site Shield…


My understanding here:

There is no varnish config for discourse to serve dynamically generated content. There are some community attempts by discourse members, but none officially endorsed. Some of it has to do with connections that are permanently open from the client to server etc.

It would have been great for fastly to take this up and provide a turnkey solution because some of the largest forums are on discourse and this would solve a lot of redundancy problems, but I don’t think it’s a priority.