Cors error

Hi,

So I have my UI on a server and rasa on another server, If I do curl from the UI server for get request it works fine, But the post request gives me method can not be called, and on the UI console I see there’s cors error. I have enabled cors in rasa run models command. What else could I be missing

You can use this command:

rasa run --cors "*"

I use this already

Can you share the command you are using to run rasa with cors enabled.

i think it should --cors [*]

could you try

rasa run -m models --enable-api --cors ["*"]

I tried that and got the same error. However I tried rasa shell and this is what I’m getting. Can anyone find out error from this.

1 Like

@souvikg10 Hey, I tried both the commands and nothing seems to work, also while doing rasa shell I got the above issue Could you please help

can you explain your stack

UI server running on what? Flask/React/NodeJS?

Rasa server might have CORS enabled which it replies in the response header but maybe your UI server isnt forwarding it to the browser, you might have to enable CORS in the UI server as well which is serviing your front end.

@souvikg10 So my UI is on javascript and I’m doing a simple ajax call to the rasa webhook api

Can your share your Ajax request. If the error is method not allowed, it is likely something else and not Cors per day. Do you get like a 405 error and which endpoint are you calling?

@souvikg10

This is my request method

Don’t see anything wrong with it :frowning:

Maybe this might be the solution

Still stuck on the same issue. Can someone please help @Juste

can you try to make the request in POSTMAN. Does it work.

if so, If it is a CORS error maybe you can modify your ajax request and try another library like jquery

it might also be possible that ajax is not handling the response headers. could be use if you can open up dev tools in chrome and show the error in the console and also the network logs

@souvikg10 this is what my headers looks like in dev tools

this looks like preflight response to check if the server accepts CORS,

if i look at your command again, could you simply remove the --enable-api

just rasa run --cors "*"

run it separately

@souvikg10 Yes, it’s the preflight, I executed the given command and still got the same issue. I’ve been trying to eliminate this preflight request, but no luck in that either

is there a proxy in between, i see you work for BNP, where i used to work before, it might be the proxy server that is blocking it

try to run the rasa server in localhost and connect from your browser

@souvikg10 The rasa server is running on localhost only. Am I missing some configuration in the credentials or endpoints file.