Support » Plugin: Chatbot with IBM Watson » 403 error, failed to load resource: index.php?rest_route=/watsonconv/v1/message

  • Resolved nicoter

    (@nicoter)


    Hi,

    On two different WordPress websites on different hostings and with different caching plugins the chatbot keeps stopping to work after some hours or days.

    In the Chrome console I see the following related error message on both websites:

    "index.php?rest_route=/watsonconv/v1/message" Failed to load resource: the server responded with a status of 403 (Forbidden)

    The issue seems to randomly appear, go away and re-appear.

    What’s the reason for this and is there a fix?

    Thanks

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

    (@intelahelp)

    Hello @nicoter. Thanks for reaching out to us.
    It seems like you use a WordPress caching plugin or external caching solution with long cache lifetime. It is the most likely reason for malfunctioning chat widget.

    WordPress has mechanism for authorizing requests to its API. WordPress issues tokens (“nonces”, numbers used once) that should be supplied with every request to WordPress API. Nonces have limited lifetime. By default it is set to 12 hours. If you have long cache lifetime, user may get the page with invalid overdue nonce that can’t pass nonce validation and causes “403 forbidden” error.

    Therefore, to solve this issue you may shorten your cache lifetime. It should help users to avoid getting nonces older than 12 hours.

    If the issue persists after changing your cache lifetime, please provide us with extended information about your plugin installation for further issue analysis. You can retrieve it by following these steps:

    • Go to your WordPress Dahsboard (sample screenshot)
    • Go to “Watson Assistant” > “Set Up Chatbot” in the left menu (sample screenshot)
    • On the “Set Up Your Chatbot” page go to “Having Issues?” tab (sample screenshot)
    • On the “Having Issues?” tab, download full log file with extended information by following the link. (sample screenshot) Don’t publish it openly on sites like WordPress Forums as it may contain sesitive information.
    • Send email with description of your issue and attached file to help@intela.io

    If you have any more issues, don’t hesistate to ask them.

    Hi @intelahelp,

    Thanks for the comprehensive reply.

    I already excluded the Watson plugin Javascript (app.js) from the cache, but this didn’t help.

    Based on your reply I now found a setting to disable the caching of the REST API. Let’s see how that goes.

    Plugin Support intelahelp

    (@intelahelp)

    Hello @nicoter.
    You shouldn’t exclude app.js from cache since it’s static and doesn’t change. Token that becomes invalid (nonce) as a result of long cache lifetime isn’t in external script like app.js. It’s in the page’s source code. Therefore, if you cache the page, the nonce becomes cached too. You shouldn’t exclude anything from cache, but should make your cache lifetime shorter.

    Ok, thanks for clarifying. I’ll re-add app.js to the cache.

    The thing is, since disabling the caching of the REST API, the bot is working. The current page has been generated by LiteSpeed Cache on 2019-04-26 02:21:30.

    That’s more than 12 hours ago and it’s still working. The default cache TTL is set to 604800 seconds which is 168 hours. I’ll let this run and see how it goes.

    Update:

    I had to set the TTL of the cache to below 12h to make it work.

    I think it would make sense to put this information into the FAQ section since most WordPress sites make use of caching plugins and will run into this issue.

    Thanks for you help, @intelahelp!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘403 error, failed to load resource: index.php?rest_route=/watsonconv/v1/message’ is closed to new replies.