Title: Bot stop working ERROR 404
Last modified: March 6, 2019

---

# Bot stop working ERROR 404

 *  Resolved [ceereals](https://wordpress.org/support/users/ceereals/)
 * (@ceereals)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/bot-stop-working/)
 * Hi,
 * my bot suddenly stop working.
    I open the developer console and see a 404 error
   for a GET request on [https://www.kinoa.tech/?rest_route=/watsonconv/v1/message](https://www.kinoa.tech/?rest_route=/watsonconv/v1/message).
 * I didn’t change any option on Watson dashbord or even in the plugin’s settings.
 * please help me.
    -  This topic was modified 7 years, 3 months ago by [ceereals](https://wordpress.org/support/users/ceereals/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fbot-stop-working%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  [kaneua](https://wordpress.org/support/users/kaneua/)
 * (@kaneua)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/bot-stop-working/#post-11283307)
 * It seems like you set up force redirect from `https://kinoa.tech/index.php?rest_route
   =/watsonconv/v1/message` to exactly the same address with code 301. It’s a problem
   with your server configuration and there are two issues with it:
    - It forces redirect to https version for this address even if https address
      is already requested
    - Redirect with code 301 does not preserve POST method, therefore it redirects
      to the same address
 * You can reproduce that behaviour by going on any of your site’s pages (for example,
   front page, not error pages or nonexistent ones). Open developer console and 
   execute Javascript code below (copy there, paste in cosole and hit Enter) to 
   recreate normal chatbot request from widget. Let’s assume that you use Chrome,
   but this example won’t be much different in any other modern browser.
 *     ```
       // Simulating normal request from chatbot frontend
   
       // Creating legal object for sending user input
       // null in session_id tells that there is no session yet and plugin should create one
       var testUserInput = {
           input: {
               message_type: "text",
               text: "test text" 
           },
           session_id: null
       };
       // Serializing test user input to JSON
       var jsonUserInput = JSON.stringify(testUserInput);
       // HTTPS Address to send request to
       var testAddress = "https://www.kinoa.tech/index.php?rest_route=/watsonconv/v1/message";
       // Object representing server request
       var testRequest = new XMLHttpRequest();
       // Setting parameters for request
       // "POST" - method
       // testAddress - variable with address
       // true - making request asynchronous
       testRequest.open("POST", testAddress, true);
       // Setting header with nonce for WordPress REST API authorization
       // WP REST API nonces are stored in JS global variable wpApiSettings.nonce
       testRequest.setRequestHeader("X-WP-Nonce", wpApiSettings.nonce);
       // Setting Content-Type to application/json
       testRequest.setRequestHeader("Content-Type", "application/json");
       // Sending request to server with JSON
       testRequest.send(jsonUserInput);
       ```
   
 * After executing this request you can go to “Network” tab and see that there are
   two requests: first is the POST with 301 (redirect), second is the GET with 404(
   not found).
 * In the plugin’s server side code there isn’t any code that responds with 301 
   code and redirects, therefore it’s your server’s redirect misconfiguration. It’s
   even more likely after previously found issues with the lack of redirect to HTTPS
   on your website.
 * If we will change our taget address from example code to alternate one with REST
   API root provided by WordPress itself on its pages with _wpApiSettings.root +“
   watsonconv/v1/message”_ (variable _testAddress_ in the code above), on the Network
   tab we would see that request goes to _[https://www.kinoa.tech/wp-json/watsonconv/v1/message](https://www.kinoa.tech/wp-json/watsonconv/v1/message)_
   and fails with 404 because of nonexistent REST route (explained futher) and **
   doesn’t have any redirects**. It means that you have improperly configured 301
   redirect for one exact address: (`/index.php?rest_route=/watsonconv/v1/message`).
 * Bot’s REST route may be be nonexistent in only two cases: ether chat widget is
   disabled or it is not called with POST method. Fact that plugin is disabled is
   proven further by absence of specific plugin related code in the source code 
   of your pages.
 * REST API definitely works because request to address `https://www.kinoa.tech/?
   rest_route=/wp/v2/posts/` responds with the list of the posts on your site. Note
   that it doesn’t have any redirects.
 * Properly reconfigured redirect should solve the problem. If not, we will gladly
   investigate this issue further.
 * [Github Gist with normal and alternate address request code](https://gist.github.com/kaneua/08790477651b9494b509ff219e903cac)
    -  This reply was modified 7 years, 3 months ago by [kaneua](https://wordpress.org/support/users/kaneua/).
    -  This reply was modified 7 years, 3 months ago by [kaneua](https://wordpress.org/support/users/kaneua/).
      Reason: Prettier formatting
    -  This reply was modified 7 years, 3 months ago by [kaneua](https://wordpress.org/support/users/kaneua/).

Viewing 1 replies (of 1 total)

The topic ‘Bot stop working ERROR 404’ is closed to new replies.

 * ![](https://ps.w.org/conversation-watson/assets/icon-256x256.png?rev=1684465)
 * [Chatbot with IBM watsonx Assistant](https://wordpress.org/plugins/conversation-watson/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/conversation-watson/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/conversation-watson/)
 * [Active Topics](https://wordpress.org/support/plugin/conversation-watson/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/conversation-watson/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/conversation-watson/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [kaneua](https://wordpress.org/support/users/kaneua/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/bot-stop-working/#post-11283307)
 * Status: resolved