<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Cloudflare Caching]]></title><description><![CDATA[<p dir="auto">To minimize load on our servers, I would like to set Cloudflare to cache as much of the content as possible.<br />
I'm assuming that any image files or anything with a css/js/json file extension is safe to cache.<br />
Obviously we can't cache html content for logged-in users, since there is user-specific data included in the headers.<br />
As far as I can tell, it should be safe to cache html content for guests as long as the TTL is short (guests cannot post on our site, if that's relevant). However, it's not clear how we can implement that. The <code>express.sid</code> cookie is set for guests, so we can't just cache when that cookie is absent. It should be possible to set a custom cookie on login and clear that cookie on logout, but I can't find anywhere to set that cookie. I'm using a fork of <a href="https://github.com/julianlam/nodebb-plugin-sso-oauth" rel="nofollow ugc">https://github.com/julianlam/nodebb-plugin-sso-oauth</a>, and the only place I can find a <code>res</code> object is <a href="https://github.com/julianlam/nodebb-plugin-sso-oauth/blob/master/library.js#L124" rel="nofollow ugc">https://github.com/julianlam/nodebb-plugin-sso-oauth/blob/master/library.js#L124</a>, but setting the cookie fails because <code>res.cookie</code> is undefined.</p>
<p dir="auto">Is there any way I can set a custom cookie on login, or ensure that NodeBB does not set an <code>express.sid</code> cookie for guests?</p>
]]></description><link>https://postcall.pub/topic/4c2a4fc2-1aef-4d92-acec-d386c19edbbf/cloudflare-caching</link><generator>RSS for Node</generator><lastBuildDate>Sun, 28 Jun 2026 01:30:49 GMT</lastBuildDate><atom:link href="https://postcall.pub/topic/4c2a4fc2-1aef-4d92-acec-d386c19edbbf.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 28 Apr 2025 21:37:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Cloudflare Caching on Wed, 29 Apr 2026 15:16:47 GMT]]></title><description><![CDATA[<p dir="auto"><a href="/user/djensen47%40community.nodebb.org">@djensen47</a> have you tried using Anubis? It's the only thing that worked, and has carveouts for search index crawlers.</p>
]]></description><link>https://postcall.pub/post/https://community.nodebb.org/post/107073</link><guid isPermaLink="true">https://postcall.pub/post/https://community.nodebb.org/post/107073</guid><dc:creator><![CDATA[julian@community.nodebb.org]]></dc:creator><pubDate>Wed, 29 Apr 2026 15:16:47 GMT</pubDate></item><item><title><![CDATA[Reply to Cloudflare Caching on Wed, 29 Apr 2026 09:09:32 GMT]]></title><description><![CDATA[<p dir="auto">&gt; <a href="https://community.nodebb.org/user/chartung" rel="nofollow ugc">@chartung</a> <a href="https://community.nodebb.org/post/104322" rel="nofollow ugc">said</a>:<br />
&gt;<br />
&gt; Is there any way I can set a custom cookie on login, or ensure that NodeBB does not set an express.sid cookie for guests?</p>
<p dir="auto">I'd like to get back to this question. Bots are hammering my site and CF Super Bot Fight mode isn't picking up new bots for me. I don't want to enable "Under Attack Mode" forever — it's not recommended.</p>
<p dir="auto">One solution is to serve up cached items to the bots from CF but I don't want to be overly aggressive caching for users.</p>
]]></description><link>https://postcall.pub/post/https://community.nodebb.org/post/107072</link><guid isPermaLink="true">https://postcall.pub/post/https://community.nodebb.org/post/107072</guid><dc:creator><![CDATA[djensen47@community.nodebb.org]]></dc:creator><pubDate>Wed, 29 Apr 2026 09:09:32 GMT</pubDate></item><item><title><![CDATA[Reply to Cloudflare Caching on Sun, 14 Dec 2025 03:37:34 GMT]]></title><description><![CDATA[<p dir="auto"><a href="/user/djensen47%40community.nodebb.org">@djensen47</a> what CF SSL settings are you working with? I think when CF terminates your SSL WS could go wonky... We use CF and web sockets work okay.</p>
]]></description><link>https://postcall.pub/post/https://community.nodebb.org/post/106367</link><guid isPermaLink="true">https://postcall.pub/post/https://community.nodebb.org/post/106367</guid><dc:creator><![CDATA[julian@community.nodebb.org]]></dc:creator><pubDate>Sun, 14 Dec 2025 03:37:34 GMT</pubDate></item><item><title><![CDATA[Reply to Cloudflare Caching on Sun, 14 Dec 2025 01:31:15 GMT]]></title><description><![CDATA[<p dir="auto">If I turn off Cloudflare proxy, the problem stops. Also, my setup is like this:</p>
<p dir="auto">internet -&gt; Cloudflare -&gt; HAProxy —vpc-&gt; NodeBB servers</p>
<p dir="auto">I'm wondering if I need to configure something between Cloudflare and the proxy?</p>
]]></description><link>https://postcall.pub/post/https://community.nodebb.org/post/106366</link><guid isPermaLink="true">https://postcall.pub/post/https://community.nodebb.org/post/106366</guid><dc:creator><![CDATA[djensen47@community.nodebb.org]]></dc:creator><pubDate>Sun, 14 Dec 2025 01:31:15 GMT</pubDate></item><item><title><![CDATA[Reply to Cloudflare Caching on Sun, 14 Dec 2025 00:15:22 GMT]]></title><description><![CDATA[<p dir="auto">I had to enable Cloudflare to cut out a massive flood of Chinese bots/crawlers. I have to Pro plan so websockets should be supported but I get nothing but errors now:</p>
<pre><code>nodebb.min.js?v=qg59f2a0n14:70  POST https://www.axisandallies.org/forums/socket.io/?_csrf=556...a5a&amp;amp;EIO=4&amp;amp;transport=polling&amp;amp;t=PiQDHrJ&amp;amp;sid=AyNfwAoKNwtqarQqAP63 400 (Bad Request)
</code></pre>
<p dir="auto">I have a rule for everything under <code>/forums</code> to bypass the cache.</p>
]]></description><link>https://postcall.pub/post/https://community.nodebb.org/post/106365</link><guid isPermaLink="true">https://postcall.pub/post/https://community.nodebb.org/post/106365</guid><dc:creator><![CDATA[djensen47@community.nodebb.org]]></dc:creator><pubDate>Sun, 14 Dec 2025 00:15:22 GMT</pubDate></item><item><title><![CDATA[Reply to Cloudflare Caching on Mon, 28 Apr 2025 22:13:29 GMT]]></title><description><![CDATA[<p dir="auto"><a href="/user/julian%40community.nodebb.org">@julian</a> No, Cloudflare can use the <code>cache-control</code> response header to determine how long to cache content, but not whether to cache content.<br />
Even if it was possible to cache based on response headers, it wouldn't be useful in this case; we want to ensure both that we're not serving user-specific content to guests (or other users) and that we're not serving guest-specific content to users, and the <code>cache-control</code> headers can only help with the former, not the latter.</p>
]]></description><link>https://postcall.pub/post/https://community.nodebb.org/post/104331</link><guid isPermaLink="true">https://postcall.pub/post/https://community.nodebb.org/post/104331</guid><dc:creator><![CDATA[chartung@community.nodebb.org]]></dc:creator><pubDate>Mon, 28 Apr 2025 22:13:29 GMT</pubDate></item><item><title><![CDATA[Reply to Cloudflare Caching on Mon, 28 Apr 2025 21:54:20 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://community.nodebb.org/user/chartung" rel="nofollow ugc">@chartung</a> you can also check out the scaling tips here:</p>
<p dir="auto"><a href="https://docs.nodebb.org/configuring/scaling/" rel="nofollow ugc">https://docs.nodebb.org/configuring/scaling/</a></p>
]]></description><link>https://postcall.pub/post/https://community.nodebb.org/post/104327</link><guid isPermaLink="true">https://postcall.pub/post/https://community.nodebb.org/post/104327</guid><dc:creator><![CDATA[julian@community.nodebb.org]]></dc:creator><pubDate>Mon, 28 Apr 2025 21:54:20 GMT</pubDate></item><item><title><![CDATA[Reply to Cloudflare Caching on Mon, 28 Apr 2025 21:53:16 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://community.nodebb.org/user/chartung" rel="nofollow ugc">@chartung</a> can CloudFlare just cache by respecting the cache control headers? That'd be the easiest and I'd be surprised if it could not.</p>
]]></description><link>https://postcall.pub/post/https://community.nodebb.org/post/104326</link><guid isPermaLink="true">https://postcall.pub/post/https://community.nodebb.org/post/104326</guid><dc:creator><![CDATA[julian@community.nodebb.org]]></dc:creator><pubDate>Mon, 28 Apr 2025 21:53:16 GMT</pubDate></item></channel></rss>