• Resolved boka003

    (@boka003)


    Hello,

    After i install lite speed cache i have problems whit load more buttons on my web site.
    If i PURE ALL CSS/JS Cache, load mote button will work just fine.

    Is it any way that i can disable CSS/JS cache? i was try to find this option in settings, but i can not find it.

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Hi @boka003, LiteSpeed server will not cache CSS and JS as they are a static file but our plugin can do optimization on both scripts, you can check the setting on LiteSpeed Cache > Setting > Optimize

    The “load more buttons” problem should related to JS Minify or JS Combine, you can check on this article to find out the bug.

    Thread Starter boka003

    (@boka003)

    Hello,

    I have try metod above and onlythink that i find is this admin-ajax.php https://prntscr.com/q5yf64

    Button load more is at end of page, called “U?ITAJ JOS”

    Is my problem with admin ajac cache?

    Thank you!

    You are right, the issue is from admin-ajax and the ajaxNonce is expired due to the page cache. Could you try to make the Public Cache TTL shorter(28800) to see does it help?

    Thread Starter boka003

    (@boka003)

    Hello, i have change this value: https://prntscr.com/q6ggdt

    But it is still same, only if i logged in wp-admin, load buttons work.
    But other users (who are not logged in) have problem with load more buttons.

    Ok, is that “load more” function from your theme or a widget? And do you know where does the dtLocal JS variable generated?

    Thread Starter boka003

    (@boka003)

    It is my theme function.

    Sorry, but i don’t know where is that dtLocal JS variable generated, is there any way how i can check that?

    @boka003, please try to put the following code on your theme’s functions.php and turn ON ESI, these codes can replace your ajax nonce to fresh nonce.

    LiteSpeed_Cache_API::hook_tpl_esi('wp_create_nonce_esi', 'nonce_esi' );
    
    function nonce_esi() {
      echo wp_create_nonce();
      exit;
    }
    
    function html_nonce_replacement($buffer) {
    	if ( ! isset( $_GET[ 'lsesi' ] ) ) {
    		$ajaxNonce_position = strpos($buffer, 'ajaxNonce') + 12;
    		$original_nonce = substr($buffer, $ajaxNonce_position, 10);
    		$esi_url = LiteSpeed_Cache_API::esi_url( 'wp_create_nonce_esi', 'Create nonce for page loader', [], 'no-cache', true ) ;
    		$buffer = str_replace($original_nonce, $esi_url, $buffer);
    	}
    
    	return $buffer;
    }
    
    if ( method_exists('LiteSpeed_Cache_API', 'esi_url') ) {
    	ob_start("html_nonce_replacement");
    }
    Thread Starter boka003

    (@boka003)

    Thank you for code.

    I have add this code to my functions.php and turn on esi, but now, loading button is not working: https://prntscr.com/q6mxk7

    It just keep loading

    @boka003 please turn LiteSpeed Cache > Settings > ESI > Enable ESI [ON]

    then clear all cache and try again.

    Thread Starter boka003

    (@boka003)

    Now it not allow me to turn it on.
    If i do, i get this message; https://prntscr.com/q6n5bj

    EDIT:
    I get it on, somehow: https://prntscr.com/q6n7s4
    But still situation is same.

    • This reply was modified 5 years, 3 months ago by boka003.

    Can you try to comment out the functions.php code I’ve sent and turn ESI ON again?

    Thread Starter boka003

    (@boka003)

    I have remove code and turn ESI on, but still no changes

    After the ESI turned ON, please try to put back:

    LiteSpeed_Cache_API::hook_tpl_esi('wp_create_nonce_esi', 'nonce_esi' );
    
    function nonce_esi() {
      echo wp_create_nonce();
      exit;
    }
    
    function html_nonce_replacement($buffer) {
    	if ( ! isset( $_GET[ 'lsesi' ] ) && ! is_admin() ) {
    		$ajaxNonce_position = strpos($buffer, 'ajaxNonce') + 12;
    		$original_nonce = substr($buffer, $ajaxNonce_position, 10);
    		$esi_url = LiteSpeed_Cache_API::esi_url( 'wp_create_nonce_esi', 'Create nonce for page loader', [], 'no-cache', true ) ;
    		$buffer = str_replace($original_nonce, $esi_url, $buffer);
    	}
    
    	return $buffer;
    }
    
    if ( method_exists('LiteSpeed_Cache_API', 'esi_url') ) {
    	ob_start("html_nonce_replacement");
    }

    If it’s still not working, please please join our Slack channel for helping us to reproduce the issue, thanks.

    Thread Starter boka003

    (@boka003)

    Thank you, i have join ti chanel

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Disable CSS/JS cache’ is closed to new replies.