CORS problem with client in Browser

I have the CORS middleware on the XData Server
I am working on my DEV machine, the server is running on my machine

All day the Client has been working fine on Brave. Suddenly it complains about CORS. Now it wont budge.

This happens, as soon as I access a value of a data field

XData.Web.Connection.pas:207 Refused to connect to 'localhost:2002/chopper/$model' because it violates the following Content Security Policy directive: "connect-src * blob: mediastream: data:". Note that '*' matches only URLs with network schemes ('http', 'https', 'ws', 'wss'), or URLs whose scheme matches self's scheme. The scheme 'localhost:' must be added explicitly.
InternalSendRequest @ XData.Web.Connection.pas:207

Is there a workaround for this?

This is why I preferred the Apache. I could have set it up in minutes. :slight_smile:
After tons of googling,

I installed the MS CORS module but that didnt work either.

So my new web.config is

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <add name="Access-Control-Allow-Origin" value="*" />
                <add name="Access-Control-Allow-Headers" value="Content-Type, Authorization, Accept, Origin, Host, Accept_Encoding, Connection, Cookie, Content-Length" />
                <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS, PATCH" />
                <add name="Access-Control-Allow-Credentials" value="true" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>

It looks like it has solved the cors issue. But I am getting this error now

ops.js:288 Uncaught TypeError: Cannot set properties of undefined (setting 'Reg_Type')
at Object.SetJSONDataForField (ops.js:128952:22)
at Object.SetJSONDataForField (ops.js:130157:66)
at Object.SetJSONDataForField$1 (ops.js:127600:12)
at Object.SetFieldData$1 (ops.js:128864:25)
at Object.SetFieldData (ops.js:107190:12)
at Object.SetData (ops.js:103585:21)
at Object.SetAsString (ops.js:103705:12)
at Object.xds_BeforeInsert (ops.js:147147:25)
at Object.cb (ops.js:255:26)
at Object.DoBeforeInsert (ops.js:106673:44)

Reg_Type is one of the fields. It doesnt matter which field I try to set a value programatically, (after insert mode). I get a similar error.

It doesn't look like a CORS issue, the error message doesn't refer to CORS.
It complains that your server URL doesn't start with http:// or https://.

Are you sure you put the correct URL in the TXDataWebConnection server property?

No need for that.

No need for any of that.

That is your application logic. Please provide more info, ideally in a different support topic, as it's unrelated to this one.

have you checked my answer on Unable to set a value or save data - BIZ / TMS XData - TMS Support Center?