Cannot upload files when Web Client is hosted on a different server - SmartPlant Foundation - Help - Hexagon PPM

SmartPlant Foundation Web Client Help

PPMProductFamily
Asset Information Management
PPMProduct
SmartPlant Foundation
PPMCategory
Help
SPFVersion_custom
2019 (10.0)
Version_SDAConnectorforTruView
(none)

The following problem can occur when you attempt to upload files using Web Client that is not hosted on the SmartPlant Foundation server.

Problem

You cannot upload files from the Web Client to the SmartPlant Foundation server and you see the following error:

XMLHttpRequest cannot load [ServerRequest]. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin '[ClientHost]' is therefore not allowed access.

Solution

A CORS request (cross-origin resource request) is a resource request from a different server domain other than the one on which it is hosted. You must update the CORS section of the web.config file of the SmartPlant Foundation server to allow the upload from the server to perform the request:

  • In the allowedOrigins field of the web.config file, specify all the possible client origin domains, separated by a comma.

    This must include the explicit protocol for each client origin domain.

  • Set the allowCredentials field option to True.

For example:

<intergraph.webApi>

<security>

<oauth issuer="[OAuthServer]/oauth" requiredScopes="ingr.api"/>

<cors allowedOrigins="http://LocalHost1.Domain.com,http://LocalHost2.Domain.com" allowedMethods="*"

allowedHeaders="*"

exposedHeaders=""

allowCredentials="true"

preflightMaxAge="600"/>

<security>