You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Request: Add CORS header config to demo.mtconnect.org agent #506
Im am working on browser-based client and getting CORS errors trying to get response docs. It is working against my local agent (that does have the above CORS config applied), but I would like to test against an "unknown" device model.
@wsobel I assumed the agent running at demo.mtconnect.org referenced the file I comitted to close this issue, but im still getting CORS denials when connecting to demo.mtconnect.org from a browser webapp.
cli apps connect fine - i believe this is only relevant for browser-based webapp clients.
are you willing to open up the CORS on demo.mtconnect.org to allow for browser webapp demonstration?
The demo agent is running using the docker compose demo and has nginx with reverse proxy. I'll check if they are passing through the CORS preflight and OPTIONS. I thought it should be working. I may need to add
extra headers as well.
Please tell me what you're trying to do with CORS and what's not working.I may need to just patch the nginx config or the cfg file for additional headers.
I am trying to use the probe() method from my lib above, but the browser shows:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://demo.mtconnect.org:5000/probe. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
well i just noticed that firefox actually gets a 200 OK response, and it DOES get the response doc content. but then blocks it from being used in scripts locally due to CORS?!
I'll check it out tomorrow. Port 5000 is supposed to be blocked, but oops. Nothing too bad,just bypassing nginx. I'll check the headers and make sure cross scripting is enabled. I can also now allow GET and OPTIONS methods.
It should work. The agent supports websockets and if something doesn't work, it would be a change to nginx to pass wesocket request through to the agent.
Tell me if you have issues. I'll get to this tomorrow.
It should only respond to https. The next step is checking to make sure the firewall is setup correctly. BestW(Sent from mobile)On May 14, 2026, at 20:27, robot-ranger ***@***.***> wrote:robot-ranger left a comment (mtconnect/cppagent#506)
seems to work now as long as im using https
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: ***@***.***>
Activity
robot-ranger commentedon Dec 6, 2024
for what its worth, we plan on opening up this client in a public repo. Gotta be functional first, though.
robot-ranger commentedon May 10, 2026
@wsobel I assumed the agent running at demo.mtconnect.org referenced the file I comitted to close this issue, but im still getting CORS denials when connecting to demo.mtconnect.org from a browser webapp.
cli apps connect fine - i believe this is only relevant for browser-based webapp clients.
are you willing to open up the CORS on demo.mtconnect.org to allow for browser webapp demonstration?
wsobel commentedon May 10, 2026
The demo agent is running using the docker compose demo and has nginx with reverse proxy. I'll check if they are passing through the CORS preflight and OPTIONS. I thought it should be working. I may need to add
extra headers as well.
Please tell me what you're trying to do with CORS and what's not working.I may need to just patch the nginx config or the cfg file for additional headers.
robot-ranger commentedon May 10, 2026
for context, I had previously transcribed the client used in the digital twin demo to typescript: https://github.com/processrobotics/mtconnect-ts/blob/main/src/MTConnect.ts
I am trying to use the probe() method from my lib above, but the browser shows:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS/Errors/CORSMissingAllowOrigin
the same webapp works fine wen directed to my local agents, albeit those are configured to allow all with the following in agent.json:
robot-ranger commentedon May 10, 2026
side note: i get
301: Moved Permanentlywhen i omit port 5000 in the url:request header without port 5000:
response header without port 5000:
request header WITH port 5000 in url:
response header WITH port 5000 in url:
robot-ranger commentedon May 10, 2026
well i just noticed that firefox actually gets a
200 OKresponse, and it DOES get the response doc content. but then blocks it from being used in scripts locally due to CORS?!wsobel commentedon May 10, 2026
I'll check it out tomorrow. Port 5000 is supposed to be blocked, but oops. Nothing too bad,just bypassing nginx. I'll check the headers and make sure cross scripting is enabled. I can also now allow GET and OPTIONS methods.
robot-ranger commentedon May 11, 2026
Does the agent at demo.mtconnect.org allow/support websocket?
its been in my mind to start moving toward websocket over http... if the demo.mtconnect.org has ws maybe now is as good a time as any...
wsobel commentedon May 11, 2026
It should work. The agent supports websockets and if something doesn't work, it would be a change to nginx to pass wesocket request through to the agent.
Tell me if you have issues. I'll get to this tomorrow.
robot-ranger commentedon May 11, 2026
no immediate rush. our webapp works on our local agents, i just wanted to pressure test it a bit with an "unknown" agent and devices model.
wsobel commentedon May 12, 2026
I added the header:
$ StandardsCommittee curl -I -X OPTIONS https://demo.mtconnect.org/probe HTTP/1.1 204 No Content Server: nginx/1.18.0 (Ubuntu) Date: Tue, 12 May 2026 18:42:45 GMT Content-Type: text/plain Content-Length: 0 Connection: keep-alive Expires: -1 Cache-Control: no-store, max-age=0 Access-Control-Allow-Origin: * Allow: GET, OPTIONS Access-Control-Allow-Methods: GET, OPTIONS Access-Control-Allow-Headers: Content-Type, Accept, Accept-Encoding Access-Control-Max-Age: 86400and
➜ StandardsCommittee curl -i https://demo.mtconnect.org/ HTTP/1.1 200 OK Server: nginx/1.18.0 (Ubuntu) Date: Tue, 12 May 2026 18:47:36 GMT Content-Type: application/xml Content-Length: 46372 Connection: keep-alive Expires: -1 Cache-Control: no-store, max-age=0 Access-Control-Allow-Origin: *Check if that helps. I can add additional headers if necessary.
I may need to add
Access-Control-Allow-Headers: Origin, Content-Type, Accept, Accept-Encodingto the allow headers line. I can modify if necessary.btw. I did not modify nginx, this is all coming directly from the agent.
robot-ranger commentedon May 14, 2026
seems to work now as long as im using https
wsobel commentedon May 14, 2026