• Resolved mipame

    (@mipame)


    Hi,
    I am using your awesome product – thanks a lot for your effort.
    But there seems to be a problem. After about 2-4 days without purging the cache manually, secure ajax requests to wp-ajax.php dont work anymore. The response is 403.
    After purging the cache it works again.
    What might be the problem?
    thanks

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @mipame

    I am sorry about the issue you are experiencing and I am happy to assist you with this.
    Can you please share what is the Expires header lifetime: in Performance>Browser Cache>HTML&XML?
    Can you please share what is the nonce lifetime for wp-ajax.php?
    Thanks!

    Thread Starter mipame

    (@mipame)

    sure.
    CSS&JS: 31536000
    HTML&XML: 3600
    Media&Others: 31536000

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @mipame

    Can you please share your website URL?
    Typically admin-ajax.php requests use a “nonce”, a semi-random string which is generated and added to the page. When the ajax gets triggered it sends that “nonce” (together with the data it tries to post) to the server where the nonce gets checked.
    Now the problem; a WordPress nonce has limited validity, typically (but not always) 4h. If the “nonce” does not check out, the request is refused, which is what you’re observing.
    The TTL of page cache files is set via the “Expires header lifetime” field in the “HTML” section on the Browser Cache Settings tab. The default there is 3600s (= 1h), so either you have a (much) higher value there OR you have a plugin which has a very short nonce lifetime.
    I hope this helps!

    Thread Starter mipame

    (@mipame)

    Thank your for your response, but I think this is not the issue.

    After purging the cache – a couple of days there is no issues. So the problem does not lie in the nonce lifetime.

    Do I have to manually purge all cache every day?
    If so, how is it done programatically?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    You can try the cache Preload feature in this case.
    Make sure to disable native wp cron and create a corn job on your server which will trigger a page visit in every 10 mins or so.
    Alternatively, you can also create a custom cronjob to programmatically purge the cache by calling w3tc_flush_all(); or wp cli:
    $ wp w3-total-cache flush all
    Thanks!

    Thread Starter mipame

    (@mipame)

    thanks.
    But this can’t be the solution – artificially visiting the website?
    Is there no other solution to this problem?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @mipame

    If you do not wish to use the Preload, you can set up the corn and call the function as suggested in the previous topic to purge the cache on the specified interval.
    Thanks!

    Thread Starter mipame

    (@mipame)

    please be so kind and explain me again- how can this be, that it is happening?

    If I want to prevent this, without clearing the cache every hour – what would be another solution?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @mipame

    As this is the first issue of this kind related to W3 Total Cache, I can only guess and the most likely issue is a nonce lifetime. I asked you to share you URL so can you please do that if possible?
    Also, ARe you using any other caching, minify solution, CDN, or server-side caching?
    What are the settings enabled in W3TC?
    Thanks

    Thread Starter mipame

    (@mipame)

    thanks for your reply. is it possible to answer you in private ? I would not wish for this information to get public.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @mipame

    Thank you for the info. Yes you can drop us a note via the plugin in Performance>Support of via the website https://www.w3-edge.com/contact/
    Thanks!

    Thread Starter mipame

    (@mipame)

    thanks – I did

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @mipame

    Thank you for the information. We received the email and checking your website.
    Please continue the correspondence via the support channel.
    Thanks!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘403 on wp-ajax.php after some time’ is closed to new replies.