• Resolved txtcoke

    (@txtcoke)


    Hello, I am having an issue with the plugin and admin-ajax.php

    My site uses admin-ajax for loading ajax loaders or showing more products on pages etc.

    When I for instance press the “more products button”, where products load over admin-ajax, nothing happens. The loader keeps loading infinitely.
    Then I checked the browser console, and I saw admin-ajax.php is returning 403.

    When I clear the plugin cache, everything starts working again, but after some hours, admin-ajax again is 403, and consequently, all loaders that rely on it do not work, keep loading forever as I mentioned.

    I’ve already whitelisted the path on the plugin settings, and it didn’t work.

    Why is that so?
    I love the plugin, I don’t want to stop using it.
    What I also don’t understand is why when I clear plugin cache, admin-ajax works properly, and shortly after (some hours), it starts again returning 403 on the browser console.

    Note: This issue never happens on the backend, when I am logged in as admin.

    How can I solve it?
    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    this is typical nonce issue
    if you are not using OpenLiteSpeed , then you can enable ESI , and also the nonce name into the ESI nonce list

    when you see it in console on that 403 , you can check the request header, it will show a nonce value , find that nonce value’s name in your HTML source code , then search through your PHP script to find out which plugin/theme generated that nonce , in that generation code , you will find the nonce name , add it into above mentioned ESI nonce list

    Best regards,

    Thread Starter txtcoke

    (@txtcoke)

    Hello, thanks for your feedback.
    I’ve found what generates the nonce.
    There is a piece of code like:

    return sprintf(
    			'<div class="%s" data-attr="%s" data-load_more="%s" data-nonce="%s">%s</div>',
    			esc_attr( implode( ' ', $css_class ) ),
    			esc_attr( json_encode( $attr ) ),
    			esc_attr( $atts['load_more'] ),
    			esc_attr( wp_create_nonce( 'theme_get_products' ) ),
    			implode( '', $output )
    		);
    	}

    So, the name of the nonce is theme_get_products?
    Thats what I should add to the ESI list?

    Thanks

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    wp_create_nonce( 'theme_get_products' )

    this seems to be the one

    try add theme_get_products into the ESI nonce list , save and purge all

    make sure you have enabled ESI as well

    and after you have done above, please provide the report number , you can get it in toolbox -> report -> click “send to LiteSpeed”

    Best regards,

    Thread Starter txtcoke

    (@txtcoke)

    Thanks.
    It seems solved.
    The issue now is that after enabling ESI, the website takes much more to load.
    Somehow seems it does not build cache as before, the time it takes to load a page seems like the time it took without having the plugin activated.
    Can ESI enable do this?
    Thanks

    Plugin Support qtwrk

    (@qtwrk)

    If one single page contains too many nonce that needs to be ESI’ed, it could slow thing down

    If esi is not good option for you then only alternatives are :

    1. Extend nonce life time, not exactly a good idea, but it works

    2. Set page cache time to lower than default nonce life time, like 6 or 8 hours

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Admin-ajax.php issue’ is closed to new replies.