Getting CORS error posting to server (revised)

I have successfully deployed a Rasa server on an AWS Ubuntu server, and it works great in the terminal, but I can’t access from a POST via fetch() . I’m trying to get the intents of some text from my model

I run this command:

rasa run --enable-api --cors “*”

It responds in the browser (i.e. with “Hello from Rasa: 2.8.3”, so it’s connected, but when I try to POST to if via fetch() it gives me a CORS error:

const url = '';
fetch(url, { method: 'POST',
     body: "{text:'Hello'}"})
    .then(res => { console.log(res);

Hi Bill, I think you just need to specify a value for cors. To accept any domain you can do this:

rasa run --enable-api --cors '*'

The only difference between my command and yours is adding the '*'. Did that help?


Tom, I think the forum formatting cut of that part on my post, so I don’t think that’s the issue. Do I need to set anything in the config.yml or endpoints.yaml?

I get this warning when I run:

/home/ubuntu/.local/lib/python3.8/site-packages/rasa/shared/utils/ UserWarning: T he model at ‘endpoints.yml’ could not be loaded. Error: <class ‘tarfile.ReadError’>: not a gzip file

I was able to solve it with this:

let xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
http.setRequestHeader(Content-Type, application/json);
1 Like