-
AuthorPosts
-
March 10, 2014 at 10:59 am #234600
I noticed that as soon as I enable Enfold, the following headers are added to the server response:
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma no-cache
This seems to affect caching on the server. As soon as I switch to another theme the server caches the page just fine.
I’m using nginx, php-fpm and fcgi_cache
March 13, 2014 at 4:16 am #236655Hi Oliomedia!
I’m not really sure on this one so I’ve tagged Kriesi on the topic.
Regards,
DevinMarch 13, 2014 at 7:26 pm #237134Hey!
Unfortunately I have no idea were this is coming from since enfold itself is not sending any additional headers. I did a quick source code check for some keywords like “must-revalidate” and there are non in the source code so I am not sure why this is happening for you :/
Cheers!
KriesiDecember 17, 2014 at 6:03 pm #369614I have the same issue with Enfold theme (version 3.0.4), disabling all the plugins did nothing, changing theme solve the problem.
Looking at the results of a recursive grep command performed on the root of this particular wordpress instance it seems there are 3 “no-cache” strings in Enfold theme’s files:[root@server v1.0]$ sudo grep -R "no-cache" ./ [sudo] password for root: ./wp-includes/class-wp.php: // If Last-Modified is set to false, it should not be sent (no-cache situation). ./wp-includes/functions.php: 'Cache-Control' => 'no-cache, must-revalidate, max-age=0', ./wp-includes/functions.php: 'Pragma' => 'no-cache', ./wp-admin/includes/ajax-actions.php: header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); ./wp-admin/includes/ajax-actions.php: header( 'Pragma: no-cache' ); ./wp-content/plugins/si-contact-form/captcha/securimage.php: header("Cache-Control: no-store, no-cache, must-revalidate"); ./wp-content/plugins/si-contact-form/captcha/securimage.php: header("Pragma: no-cache"); ./wp-content/themes/Enfold/config-layerslider/LayerSlider/classes/class.ls.exportutil.php: header('Pragma: no-cache'); ./wp-content/themes/Enfold/enfold/config-layerslider/LayerSlider/classes/class.ls.exportutil.php: header('Pragma: no-cache'); ./wp-content/themes/Enfold/enfold/framework/php/wordpress-importer/avia-export-class.php: header("Pragma: no-cache"); ./wp-content/themes/Enfold/framework/php/wordpress-importer/avia-export-class.php: /*header("Pragma: no-cache");*/
Do you have any idea on how to prevent Enfold to send no-cache headers?
December 17, 2014 at 10:34 pm #369777Hey!
Those only get added when exporting the theme options.
Go ahead and deactivate all plugins and send us a link to your site so we can take a look. Also be sure to deactivate all browser plugins and extensions and check in a different browser as well.
Best regards,
ElliottDecember 18, 2014 at 1:15 am #369829This reply has been marked as private.December 18, 2014 at 5:47 pm #370106Hey!
Hmm, try activating just the parent theme and check. Also try switching to the WordPress default theme and check to see if it happens there as well.
Cheers!
ElliottDecember 18, 2014 at 6:50 pm #370135Hi, I did what you suggested, with the parent theme the headers are still there while they are gone the moment I switch to wordpress default theme (Twenty Fourteen).
Plugins were all disabled.December 18, 2014 at 11:25 pm #370286Hi!
Not really sure where it could be coming from. Try completely deleting Enfold before downloading + uploading a fresh copy from themeforest. Also try contacting your hosting provider to see if they have any idea on why that would be happening.
Best regards,
ElliottApril 24, 2015 at 4:34 pm #434207It took me a while but I found the solution to the problem.
For some reason when using Enfold (and also some other plugins/themes, like for example MainWP) some nasty headers get added to every HTTP response.
The solution was to edit php.ini configuration file and change the following two parameters:session.use_cookies = 0 session.cache_limiter = public
This way I get no more no-cache headers and Nginx correctly cache pages.
April 26, 2015 at 9:09 am #434801Hi!
Great, thanks for sharing the solution. Is the problem fixed now or are you still experiencing problems?
Cheers!
RikardApril 30, 2015 at 9:36 am #437257Hi,
I have the same problem.
My host offers Varnish but it does not work with Enfold.Its not in any plugins because if i switch to another theme (like twenty fourteen) the cache works fine.
But in Enfold (latest, no child theme) it shows
Pragma: no cache
and
X-Cacheable NO: Backend headersI am not logged in, have no domain nor session cookies and trying incognoto mode in chrome.
I also added the two php settings in htaccess (because i have no access to php.ini).
I use apache.Please help because this is really important.
April 30, 2015 at 9:37 am #437260This reply has been marked as private.April 30, 2015 at 9:59 am #437275Installing this extension will allow me to use varnish with Enfold:
https://wordpress.org/plugins/add-headers/But i still think this is worth investigating.
May 1, 2015 at 5:28 pm #438198Hi!
Thanks for the plugin recommendation. We’ll keep this open for other users.
Cheers!
ElliottDecember 3, 2015 at 7:09 am #546256I have been experiencing the same issue with our company website. We are using varnish in front of wordpress, but it doesn’t cache page content because of the no-cache headers.
GiorgioAldeghi’s answer about changing php.ini settings for session.cache_limiter = public gave me a hint as to the cause. The no-cache headers are being added by PHP as a result of starting a PHP session, as I can see in my headers that there is also a session cookie being set when it shouldn’t be:
curl -I localhost
HTTP/1.1 200 OK ... Set-Cookie: PHPSESSID=j6pvq3vodd9nrl5a0tlkacvv86; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache ...
A session should definitely not be started for viewing normal page content when not logged in.
I did a grep search for session_start and found the culprits in avia related files:
$ grep -r -i –include \*.php session_start *
htdocs/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/portfolio.php: if(!is_admin() && !current_theme_supports(‘avia_no_session_support’) && !session_id()) session_start();
htdocs/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/masonry_entries.php: if(!is_admin() && !current_theme_supports(‘avia_no_session_support’) && !session_id()) session_start();As you can see, the avia-shortcodes are starting a session if we are not admin and the current theme does not support ‘avia_no_session_support’ and we don’t already have a session.
The solution for me was to add the following to my child theme functions.php:
function custom_theme_setup() { add_theme_support('avia_no_session_support'); } add_action( 'after_setup_theme', 'custom_theme_setup' );
But the real solution should be for Kreisi to fix this issue for the theme itself.
- This reply was modified 9 years ago by Dingers90. Reason: it may have looked like i work for google
December 3, 2015 at 9:27 pm #546655Hey!
The sessions are used for the breadcrumbs so if you disable them then the portfolio breadcrumbs will not link back to the page where you used the portfolio grid shortcode on.
Best regards,
ElliottDecember 4, 2015 at 1:59 am #546788The sessions are used for the breadcrumbs so if you disable them then the portfolio breadcrumbs will not link back to the page where you used the portfolio grid shortcode on.
I don’t use the portfolio so that’s not a concern for me. I’m more interested in getting caching to work properly to make my site fast.
If i’m not using the portfolio shortcode, enfold shouldn’t be starting a session?
December 7, 2015 at 5:41 pm #548162Hey!
A session will still be created unless your using this.
add_theme_support('avia_no_session_support');
Best regards,
Elliott- This reply was modified 9 years ago by Elliott.
December 8, 2015 at 3:09 am #548481Elliot, I’m a bit confused because in this forum you can’t directly reply to a certain post
A session will still be created unless your using this.
Who are you responding to?
Can you confirm that adding the above code snippet will break portfolio breadcrumbs and portfolio breadcrumbs only?
Also I am curious why the session is started even on a page that is not using portfolios at all. This seems to be a bug.
December 9, 2015 at 5:08 am #549458Hi!
1. That’s for you.
2. Yes
3. I explained that here, https://kriesi.at/support/topic/enfold-seems-to-add-cache-disabling-headers/#post-546655. We have no idea on which pages you use the portfolio grid shortcode on and if a portfolio post was navigated to from a page or from an external source so sessions are required to track that.
If you do not want to use them then just use this, https://kriesi.at/support/topic/enfold-seems-to-add-cache-disabling-headers/#post-548162.
Regards,
Elliott- This reply was modified 9 years ago by Elliott.
June 3, 2016 at 1:23 pm #642536never mind
- This reply was modified 8 years, 6 months ago by Ralf.
-
AuthorPosts
- The topic ‘Enfold seems to add cache-disabling headers’ is closed to new replies.