Tagged: , ,

Viewing 22 posts - 1 through 22 (of 22 total)
  • Author
    Posts
  • #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

    #236655

    Hi Oliomedia!

    I’m not really sure on this one so I’ve tagged Kriesi on the topic.

    Regards,
    Devin

    #237134

    Hey!

    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!
    Kriesi

    #369614

    I 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?

    #369777

    Hey!

    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,
    Elliott

    #369829
    This reply has been marked as private.
    #370106

    Hey!

    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!
    Elliott

    #370135

    Hi, 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.

    #370286

    Hi!

    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,
    Elliott

    #434207

    It 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.

    #434801

    Hi!

    Great, thanks for sharing the solution. Is the problem fixed now or are you still experiencing problems?

    Cheers!
    Rikard

    #437257

    Hi,

    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 headers

    I 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.

    #437260
    This reply has been marked as private.
    #437275

    Installing this extension will allow me to use varnish with Enfold:
    https://wordpress.org/plugins/add-headers/

    But i still think this is worth investigating.

    #438198

    Hi!

    Thanks for the plugin recommendation. We’ll keep this open for other users.

    Cheers!
    Elliott

    #546256

    I 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
    #546655

    Hey!

    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,
    Elliott

    #546788

    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.

    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?

    #548162

    Hey!

    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.
    #548481

    Elliot, 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.

    #549458

    Hi!

    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.
    #642536

    never mind

    • This reply was modified 8 years, 6 months ago by Ralf.
Viewing 22 posts - 1 through 22 (of 22 total)
  • The topic ‘Enfold seems to add cache-disabling headers’ is closed to new replies.