sanic.exceptions.MethodNotSupported: Method OPTIONS not allowed for URL /webhooks/rest/webhook

I am trying to create a UI using HTML and js. When i call a ajax call from js i am getting this error:

sanic.exceptions.MethodNotSupported: Method OPTIONS not allowed for URL /webhooks/rest/webhook

How can i solve this?

<!DOCTYPE html>
<html lang="en" dir="ltr">
<meta charset="utf-8">
<script src=""></script>

    console.log('am here');
  		url: "http://localhost:5005/webhooks/rest/webhook",
  		contentType:"application/json; charset=utf-8",
  			success: function(result){



url: "http://localhost:5055/webhook"


url: "http://localhost:5002/api"   /// please explain the purpose of this url

I tried curl command from the terminal like this:

curl -XPOST localhost:5005/webhooks/rest/webhook -d '{"sender":"Me","message":"hi?"}'

and it worked, also tried from an API client, that also worked. But from the JS its not working.

How can i solve this?

hey @kabeer, can you check this ajax call code:

hey @JiteshGaikwad I tried your code, but still same error. Actually what’s the difference between our codes?

I thought might be the contentType

how did you start your rasa server, I mean the command for the rasa server?

did you tried using the below command:

rasa run -m models --enable-api --cors “*” --debug


Here is the command rasa train && rasa run --enable-api --cors "*" --debug

Yes, i tried. But no luck

@kabeer Did you solve this problem? I am facing the same issue. Please guide me

Hey, i’ve bumped into this same problem but i solved mine by using the “post” method in jquery.

from having this code:

		url: "http://localhost:5005/webhooks/rest/webhook",
		type: "POST",
		contentType: "application/json",
		data: JSON.stringify({ message: message, sender: user_id }),
		success: function (botResponse, status) {

change it to something like this:

	    { message: message, sender: user_id },
            function (botResponse, status) {

I don’t know why this works but it works for me.