CORS error when trying to log in to the Web Client - SmartPlant Foundation - IM Update 46 - Help - Hexagon

SmartPlant Foundation Web Client Help

Language
English
Product
SmartPlant Foundation
Search by Category
Help
SmartPlant Foundation / SDx Version
10

Problem

When you try to log on to the Web Client application, you instead receive the following CORS (Cross-Origin Resource Sharing) error.

CORS error message_SAM

Cause

CORS error can happen when Smart API Manager is configured on a different host than the Web Client application. You might encounter this error when the HxGN SDx or SmartPlant Foundation host details are not present in the appsettings.json file.

Solution

A CORS error occurs when a resource is requested from a server domain different than the domain on which the requesting application is hosted. You must update the CORS section of the appsettings.json file of the Smart API Manager server to allow log in to the Web Client.

In the AllowedOrigins section of the appsettings.json file, add all the possible HxGN SDx or SmartPlant Foundation host domains, separated by a comma.

For example:

"Security": {

"Cors": {

"AllowedOrigins": [

"https://<machinename>.ingrnet.com",

"http://<machinename>.ingrnet.com",

],

SHARED Tip After making this change, you might still receive a CORS-related error based on the AllowCredentials setting. For more information, see Web Client access error when SAM is hosted on a different server.