I have a question about the consumption of information with API.
generate an API in web dev at the time of testing in postman everything is fine
but when consuming it in react it throws me the following error:
Access to fetch at ‘from origin’ http: // localhost: 3000 ‘has been blocked by CORS policy: 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.
some solution without using chrome extensions is frontend or ignition server problem
As previously mentioned, you have the ability to return your own OPTIONS headers in Webdev. You have to write the code yourself to return the right header values. If you have some code written and it's not working, provide your code.
You're looking for a single solution to a problem for which there is no single solution. The right CORS headers to use are going to depend on your application. You must do the research yourself.
Hi, I've the same problem like Ricardo.
We've created different kind of services for POST and GET but when we create a POST with a body the Ignition response:
Has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.
I didn't find any solution in all the forum and we tried all your post and suggestions of how to create the script in Ignition but nothing happen.
Can you help me with this?
Our platform is made in React JS calling the services with axios POST method, headers content-type application/json.
We don't have a Wireshark. At the beginning appears a message that Request OPTIONS 501 Not implemented.
We change the doPost to doOptions. The problem continues and appears a message:
Has been blocked by cors policity request header field content-type is not allowed by access-control-allow-headers in preflight response.
We added a Access-Control-Allow-Headers: * but right now the answer of Ignition is slow and appears a network slow message.
Are you trying to read tags from a React project to the ignition gateway? probably is not the best way to do that,if you want to show actual values (means every second), or what are you trying to read or write?.