Notifications
Clear all

wpForo 1.x.x [Closed] no-cache headers

11 Posts
5 Users
0 Reactions
1,271 Views
Posts: 3
Topic starter
(@diggerdog)
Active Member
Joined: 5 years ago

I have been talking to site ground about the speed of my site and they noticed that within the headers there was the following added by WpForo:

cache-control: no-store, no-cache, must-revalidate
pragma: no-cache

Which was causing issues to the dynamic caching of the website. Is there a way to prevent these headers so it doesn't interfere with the dynamic cache?

I am using the siteground SG Optimiser plugin for my cache.

10 Replies
Posts: 3
Topic starter
(@diggerdog)
Active Member
Joined: 5 years ago

Extra info, disabling WpForo take 2 seconds off my site loading time in GTmetrix.

4 Replies
Moderator
(@martin)
Joined: 8 years ago

Support Team
Posts: 992

@diggerdog,

The header doesn't have any relation to wpForo.

For the speed, please make sure wpForo cache options are enabled in Dashboard > Forums > Settings > Features admin page. Also, try to install Autoptimize plugin and test the speed. Current wpForo versions work fine with this plugin. This is not a cache plugin but does well optimization of forum page loading speed.

And read this support topic to exclude forum from your cache solutions: https://wpforo.com/community/faq/wpforo-and-cache-plugins/#post-37150

 

(@anonymous20)
Joined: 9 years ago

Noble Member
Posts: 1602

@martin

Sorry to step in, apparently you are far more into this, still Auto Optimize doesn't work right.

Even here (see my capture as a small example). Several things must be excluded and that is not easy to find (i know what to exclude but most do not).

Fast Velocity optimizer works well with wpForo and Wordpress also, if someone needs to optimize.

 

Moderator
(@martin)
Joined: 8 years ago

Support Team
Posts: 992

@anonymous20,

I don't see any issue on the screenshot. What's wrong exactly?

 

(@anonymous20)
Joined: 9 years ago

Noble Member
Posts: 1602

@martin

Just press the full screen option of the editor. A visual problem, still there are some here and there.

 

Posts: 1602
(@anonymous20)
Noble Member
Joined: 9 years ago

Nothing like that is added by wpForo, not in my sites.

As for the extra 2 seconds added, what exactly is the question?

Also no caching works right with wpForo, this has been talked and even pinned here. Exclude wpForo from any caching and/or optimizer. At least until you have a need for them. When that time arrives, there is also plenty of info posted here.

 

Posts: 3
Topic starter
(@diggerdog)
Active Member
Joined: 5 years ago

I have excluded WpForo from the cache. When I disable WpForo the issue goes away so it is caused by the plug in.

Posts: 21
(@davehamilton)
Eminent Member
Joined: 7 years ago

Ok, we've sleuthed and solved this problem, at least for ourselves.

The issue is that when session_start() is called, PHP does whatever session_cache_limiter() is set for it to do. And, by default, it's set to nocache which, as you might now guess, yields:

Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache

In and of itself, this is fine. The problem is that wpForo is calling session_start() for ALL requests, including those that aren't logged in. Why, of course, is something perhaps the admins here might be able to answer.

But we can get around it. I'll add the caveat that what we've done works on our server with our setup. It probably will work for many others, but I can't guarantee that, of course.

We fixed it by editing wp-content/plugins/wpforo/wpf-includes/class-notices.php and adding the (current as of the date of this post) line 16 session_cache_limiter('');. Essentially replacing the three-line function that's there with this four-line one, adding the bolded/red line:

private function init(){
session_cache_limiter('');
if( !wpforo_is_session_started() && ( !is_admin() || (!empty($_GET['page']) && strpos($_GET['page'], 'wpforo-') !== false ) || (wpforo_is_ajax() && !empty($_POST['action']) && false !== strpos($_POST['action'], 'wpforo')) )) session_start();
}

wpForo is still starting its session on non-logged-in users, but now it's not causing the no-cache headers to be sent. The good news is that when a Wordpress user is logged in, that causes Wordpress's no-cache headers to be sent, accomplishing pretty much the same goal.

This seems to affect every single site upon which wpForo runs, including this site and the entire gVectors.com site, too.

I'll be curious to hear what the wpForo authors think about all this.

2 Replies
Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1862

@davehamilton,

This will be fixed in the next version of the plugin update.

Besides, Please note the wpForo refused session and does not use it. 

(@davehamilton)
Joined: 7 years ago

Eminent Member
Posts: 21

@alvina I’m not sure I understand what you’re saying.

has woForo been starting an unnecessary session for years, sitewide, anywhere it’s been installed?

Am I understanding this correctly?