Table Of Contents

Configure a LabVIEW Web Service CORS for Open Access

Last Modified: November 16, 2020

Configure CORS to allow any origin access to your WebVI resources.

This CORS configuration is the least secure configuration. Any origin can access your web service and application resources. For example, any web page the browser visits could run scripts that make requests to the web service.

spd-note-note
Note  

The following content only applies to LabVIEW Web Services deployed to the LabVIEW Application Web Server. NI recommends deploying LabVIEW Web Services to the NI Web Server instead.

What to Use

You can find the Web Services API on the Connectivity palette in LabVIEW.
spd-note-note
Note  

LabVIEW NXG does not support creating web services.

  • LabVIEW Web Service Request
  • Set HTTP Header

What to Do

Create the following diagram in a Web Resources VI to configure a LabVIEW Web Service to allow CORS from any origin.

A new Web Resources VI automatically adds the LabVIEW Web Service Request class to the block diagram and terminal pane.

Set HTTP Header sets the HTTP header value in response to a request.

Use the header Access-Control-Allow-Origin to indicate if the origin making the request can access the response of your Web Service VI.

Use wildcard (*) as the header value to allow any origin to access your WebVI resource.

Troubleshooting

If you encounter errors, try the following troubleshooting strategy:
  • Verify the header and header value are correct.

Recently Viewed Topics