# Getting CORS error posting to server (revised)

**URL:** <https://forum.rasa.com/t/getting-cors-error-posting-to-server-revised/47268>\
**Category:** Getting Started with Rasa\
**Created:** [August 28, 2021, 1:20am UTC](https://forum.rasa.com/t/getting-cors-error-posting-to-server-revised/47268 "2021-08-28T01:20:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bferster](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/bferster/32/16714_2.png) [@bferster](https://forum.rasa.com/u/bferster)\
**Post date:** [August 28, 2021, 1:20am UTC](https://forum.rasa.com/t/getting-cors-error-posting-to-server-revised/47268/1 "2021-08-28T01:20:59Z")

</div>

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. xxx.xxx.xxx:5005) 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:

```auto
const url = 'http://xxx.xxx.xxx.xxx:5005/model/parse';
fetch(url, { method: 'POST',
     body: "{text:'Hello'}"})
    .then(res => { console.log(res);

```

---

<div class="post-metadata">

**Author:** ![TomV](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tomv/32/15917_2.png) [@TomV](https://forum.rasa.com/u/TomV)\
**Post date:** [August 28, 2021, 6:06am UTC](https://forum.rasa.com/t/getting-cors-error-posting-to-server-revised/47268/2 "2021-08-28T06:06:48Z")

</div>

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

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

```

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

Tom

---

<div class="post-metadata">

**Author:** ![bferster](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/bferster/32/16714_2.png) [@bferster](https://forum.rasa.com/u/bferster)\
**Post date:** [August 28, 2021, 12:39pm UTC](https://forum.rasa.com/t/getting-cors-error-posting-to-server-revised/47268/3 "2021-08-28T12:39:05Z")

</div>

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/io.py:97: UserWarning: T he model at ‘endpoints.yml’ could not be loaded. Error: \<class ‘tarfile.ReadError’\>: not a gzip file

---

<div class="post-metadata">

**Author:** ![bferster](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/bferster/32/16714_2.png) [@bferster](https://forum.rasa.com/u/bferster)\
**Post date:** [August 28, 2021, 9:37pm UTC](https://forum.rasa.com/t/getting-cors-error-posting-to-server-revised/47268/4 "2021-08-28T21:37:05Z")

</div>

I was able to solve it with this:

```auto
let xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
            console.log(this.response);
            } 
        }
xhttp.open(POST, http://xxx.xxx.xxx:5005/model/parse);
http.setRequestHeader(Content-Type, application/json);
xhttp.send(JSON.stringify({text:msg}));

```
