Cors error

when you try this to make ajax request, do you still have a preflight response?

Yes

well i tried this and it works for me

<!DOCTYPE html>

<head>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>

    <script>
        var postData = { "sender": "123", "message": "hello" }
        $.ajax({
            url: "http://localhost:5005/webhooks/rest/webhook",
            type: "POST",
            data: JSON.stringify(postData),
            success: function (data, textStatus, jqXHR) {
                alert('Success!');
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert('Error occurred!');
            }

        });
    </script>
</head>

command was rasa run --cors "*"

Is there any authentication introduced in the rasa api, As it was working locally ever since yesterday but now it says you must be authenticated to visit this url

what is the URL, are you sure this isn’t your proxy?

Do you still have cors error?

@Garima763 i am also facing the same cors issue did u sloved it ?

@annaakhil12 - did the above solution not work for you?

could you explain in detail? i am surprised a lot of people are facing this issue. :frowning:

@souvikg10 when i was intergrating rasa with UI locally its working fine ,but when i am doing it from server i am getting cors error( i am using ssl servers).

Mixed Content: The page at 'https://ipaddres/chat’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://ip address’. This request has been blocked; the content must be served over HTTPS

This isn’t CORS error.

This is the issue when you use iframes or make ajax request to non-secure http sites. Mixed contents are blocked by chrome.

if your frontend is server over https, please deploy the rasa server over https as well. this issue will disappear

@souvikg10 do you have any idea how run rasa in https. should we change any configurations in endpoints.yml or cerdtinals.yml

I could finally close this issue It was not related to cors or any config issue The mapping of urls on apache was wrong and had to correct that.

You can go through the docs

rasa run --ssl-certificate myssl.crt --ssl-keyfile myssl.key --ssl-password mypassword

Hi I getting the cors error in rasa webchat. I am starting rasa server using "rasa run -m models --enable-api --endpoints endpoints.yml --cors ‘*’ ".

The Error: Access to XMLHttpRequest at ‘http://localhost:5005/socket.io/?EIO=4&transport=polling&t=O7o2QMr’ from origin ‘http://localhost:8080’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Please help me with this.

If you are running both on the same machine, google chrome disables CORS requests in the browser.

You can install an extension on your browser called CORS, to allow Cross origin requests on your chrome browser when both servers are running on localhost.

Thank you for solution. The cors got solved.