Hi,
I get this error every time I try to access my POST endpoint in the Ignition Web dev module.
Access to fetch at 'http://127.0.0.1:8088/system/webdev/MES/tags' from origin 'http://localhost:8668' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
And this is my code on the client side:
url = "http://127.0.0.1:8088/system/webdev/MES/tags"
data = { 'nestedResponse': false,
'paths': [ {'recursive': false, 'path': '[default]SIM/realistic'},
{'recursive': false, 'path': '[default]SIM/ramp 1'}
]
}
fetch(url, {
mode: 'no-cors',
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(data)
})
.then(res => res.json())
.then(data => {
for (const tag in data.values) {
console.log(tag)
console.log(data.values[tag])
}
})
As I understand I need to disable the CORS policy mode in server side but I dont know how to do that.