Cannot upload files when Web Client is hosted on a different server - HxGN SDx - Update 63 - Administration & Configuration

Administration and Configuration of HxGN SDx

Language
English
Product
HxGN SDx
Search by Category
Administration & Configuration
SmartPlant Foundation / SDx Version
10

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

Problem

You cannot upload files from the Web Client to the HxGN SDx 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 HxGN SDx 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>