mtconnect / cppagent

C++ Agent toolkit - Pre-built binaries, visit: https://github.com/mtconnect/cppagent/releases Docker images available at https://hub.docker.com/repositories/mtconnect
http://mtcup.org/
Apache License 2.0
141 stars 90 forks source link

HTTP OPTIONS verb not supported by Agent #486

Open mnoomnoo opened 2 weeks ago

mnoomnoo commented 2 weeks ago

I’ve been building an web based asset tool using React and the Axios HTTP library. GET and POST requests sent to the Agent work without issue. When I try to delete an asset using the DELETE verb I get the following error from the agent logs:

When I look at the browser logs I see the following: XHR OPTIONS http://localhost:5000/asset/newTask CORS Preflight Did Not Succeed

It seems that the Agent doesn’t support the OPTIONS verb for the CORS preflight when attempting to use the DELETE verb. I tried the javascript fetch function to see if the issue was being caused by Axios, but the result is the same.

I have this in my Agent config:

"HttpHeaders": {
  "Access-Control-Allow-Origin": "*",
  "Access-Control-Allow-Methods": "*",
  "Access-Control-Allow-Headers": "Accept"
},