Hosting NodeBB behind a cache or CDN



  • I'd like to move my NodeBB installation behind a web cache (AWS CloudFront in my case).

    This raises the question: which resources are cache-compatible? What does a successful caching configuration look like for a NodeBB site?

    Generally, we would want to forward query strings and cookies to the origin, as these are integral to NodeBB's operation. And It seems like a good idea to disable caching on the /admin/ and /api/admin/ paths. But what else?

    Do you have experience setting up something like this?


  • Global Moderator

    This might be a useful resource

    https://github.com/NodeBB/nodebb-plugin-cdn

    Though it's not really a cache per se, just a CDN for static assets.


  • Community Rep

    We use CloudFlare, works great. Anything static can be cached.



  • @PitaJ I saw that but it looked like it wouldn't fit my requirements. That is to say, it appears that NodeBB would still the first-responder to requests; it just alters paths to various static assets so that they will be accessed through the CDN.

    Instead what I'm hoping for is for the CDN to be the first-responder for all requests, with a rule-set that causes it to pass-through requests that shouldn't be cached and interdict requests that can be cached.


  • Community Rep

    @JavadocMD said in Hosting NodeBB behind a cache or CDN:

    @PitaJ I saw that but it looked like it wouldn't fit my requirements. That is to say, it appears that NodeBB would still the first-responder to requests; it just alters paths to various static assets so that they will be accessed through the CDN.

    Instead what I'm hoping for is for the CDN to be the first-responder for all requests, with a rule-set that causes it to pass-through requests that shouldn't be cached and interdict requests that can be cached.

    For a forum, that's not very practical, in reality. There is so little that can be cached, and every request has to hit NodeBB. There's not much benefit to being "behind" a cache. We are behind CloudFlare, and they take a lot of our load, but they can't cache any pages because literally everything on NodeBB is dynamic. So other than caching things like JS libraries and CSS pages, it can't do much. And you still need a CDN to handle your media on the back end, presumably.

    Having CF in front is nice, but it is the back end CDN that PitaJ is talking about that makes the real differences for you.



  • @scottalanmiller Those are fair points. In this particular instance I'm less concerned about improving site performance than on capitalizing on CloudFront's other features, like WAF integration.

    Sounds like I'm in a very small niche here.


Log in to reply
 

Suggested Topics

  • 3
  • 9
  • 2
  • 7
  • 14
| |