Is there a caching plugin for nodebb like WP Super Cahce?



  • I mean something like this (nginx.conf):

    set $cache_uri $request_uri;
    

    ...

    # Don't use the cache for logged-in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+
                         |wp-postpass|wordpress_logged_in") {
        set $cache_uri 'null cache';
    }
    

    ...

    # Set the cache file
    set $cachefile "/wp-content/cache/supercache/$http_host/$cache_uri/index.html";
    if ($https ~* "on") {
        set $cachefile "/wp-content/cache/supercache/$http_host/$cache_uri/index-https.html";
    }
    
    # Add cache file debug info as header
    add_header X-Cache-File $cachefile;
    
    # Try in the following order: (1) cachefile, (2) normal url, (3) php
    location / {
        try_files $cachefile $uri $uri/ /index.php;
    }
    

    The above example is from nginx.conf for WP Super Cache.

    The idea is Nginx to serve html content from the cache (static files) instead of sending requests to nodebb if the user is anonymous (search engines, not signed in visitors, etc.).



  • I just found out that NodeBB is using two cookies: io and express.sid not only if the user is logged in, but for all users.

    Because of this serving cache this way is not possible (WP writes some cookies only for logged in users and this way they can be differentiated by Nginx from anonymous users).


  • Global Moderator

    @vstoykov Hi, thanks for reporting this.

    Would you mind opening an issue on our Github page? It allows us to track these kinds of things more easily.




Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.