Table Of Contents

Configuring CORS for a LabVIEW Web Service

Last Modified: November 16, 2020

You may need different CORS configurations for each LabVIEW Web Service in your application during development and deployment.

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.

To determine the origin of a web application executing in the development environment, refer to Hosting a Web Application During Development. During development using a LabVIEW Web Service, configure CORS to test your application in the LabVIEW editor.

LabVIEW Web Services only allows simple cross-origin requests and cannot respond to CORS preflight requests from a web browser. Use the following table to find the best CORS configuration for your web application.
spd-note-note
Note  

You do not need to enable CORS if your WebVI and LabVIEW Web Service have the same origin. To achieve this, host the built WebVI in the Public Content Folder of the LabVIEW Web Service the WebVI is making HTTP requests to when running your web application.

Goal CORS Configuration Configuration Instructions
Share your web application resources publicly and receive requests from any origin.
spd-note-note
Note  

This configuration is the least secure. Any origin could access your web service.

  • No credentials
  • Unfiltered Origins
Configure a LabVIEW Web Service CORS for Open Access
Allow specific origins you define or well-known origins to access your web application resources that do not require credentials.
  • No credentials
  • Filtered Origins
Configure a LabVIEW Web Service CORS for Filtered Access
Allow specific origins you define or well-known origins to access your web application resources and you want to enable sharing credentials, such as cookies.
  • Credentials
  • Filtered Origins
Configure a LabVIEW Web Service CORS for Credentialed Access

Recently Viewed Topics