CORS and WSG Configuration

In order to have a successful connection to ProjectWise Work Area connections.
Bentley Web Services Gateway (WSG) needs to be configured with CORS configuration.

 First off what is CORS? CORS stands for Cross-Origin Resource Sharing. To make it simple it's when a.com
Is making a request to b.com to request resources such as image files, icons, etc…

 https://msdn.microsoft.com/en-us/magazine/dn532203.aspx

These are the steps to take to configure CORS:

  1. Navigate to the Site in which you deployed WSG
  2. Open web.config in notepad
  3. Look for the following  AccessControlAllowOrigin and change the value to "*.bentley.com"

    <!--Comma separated domains that are allowed to initiate cross-origin requests using CORS. You can specify fully qualified domain URL

        (e.g. value="http://www.example.com"), subdomain (e.g. *.example.com) or empty value to deny any cross-origin access. "*" value can be used to

        allow cross-origin access to all domains but it is not recommended due to security concerns  -->

    <add key="AccessControlAllowOrigin" value=""/>

*Please note "*" value can be used to allow cross-origin access to all domains but it is not recommended due to security concerns  -->

For accessing ProjectWise Share work area connection add https://projectshareportal.bentley.com

  <add key="AccessControlAllowOrigin" value="https://projectshareportal.bentley.com"/>

Version 2.6+ WSG Installation wizard allows  configurable option for CORS in the Installer.

Anonymous