Error 363650, No Access-Control-Allow-Origin, Cross-Origin Resource Sharing Error

Updated Jun 14, 2018

Reported In

Software

  • LabVIEW NXG Web Module

Issue Details

  • I am receiving the following error when trying to run my LabVIEW NXG WebVI:
JavaScript message in Main.html at line 0: XMLHttpRequest cannot load http://127.0.0.1:8001/Web_Server/ParametricCurve. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:51485' is therefore not allowed access.
  • When trying to connect to a LabVIEW Web Server from a LabVIEW NXG WebVI I get Error 363650 stating that a Network error has occurred, and that a possible reason is cross origin resource sharing, or that the client cannot reach the target server

Solution

In your LabVIEW Web Server, use the Set HTTP Header.vi to set the HTTP Header field "Access-Control-Allow-Origin". You could choose the value "*" to allow any domain, as in the figure below, or you could specify the allowed domain on its own.
Note: The LabVIEW Web Server is hosted in the current generation of LabVIEW while the Web VI is built in LabVIEW NXG. 

Additional Information

You can learn more about using Cross-Origin Resource Sharing outside of the LabVIEW context by looking at the Using CORS tutorial published by Html5 Rocks or by looking at Cross-Origin Resource Sharing (CORS) whitepaper by Mozilla

WAS THIS ARTICLE HELPFUL?

Not Helpful