When attempting to upload file to storage bucket, why is the below exception thrown?
Could not connect to server (error 101)
Issue Description: When uploading files to Storage Buckets in AWS or Azure, the below exception is thrown
- Could not connect to server (error 101)
Resolution:
Content Security Policy is a web browser security layer that prevents a web app from making requests outside a trusted set of hosts.
- Confirm this is a CSP issue by replicating this issue while checking the HAR trace in the browser. Observe an exception caused from CSP, although in some cases there may not be a very clear exception showing a CSP issue and may be somewhat tricky to nail down.
- Content Security Policy is a web browser security layer that prevents a web app from making requests outside a trusted set of hosts. If a clear exception is not seen in the HAR trace, confirm if using a secure domain in Azure or AWS, such as govcloud. This can help narrow down if CSP is the issue. Check the Content Security Policy for the domains being called.
Example:
- See that there is a reference to the usgovcloud where the storage buckets exist
- To fix possible CSP issues, add the Buckets.ContentSecurityPolicy app setting and set its value to a comma-separated list of all domains to be allowed
- To update Buckets.ContentSecurityPolicy in app settings for Orchestrator hosted in Automation Suite, use the Orchestrator configuration tool mentioned Configuring appSettings
- Login to one of the Automation Suite nodes and navigate to the Tools directory. This is normally located in path /opt/UiPathAutomationSuite/ASVERSION/installer/Tools"
Example image:
- Use the Orchestrator tool to update config map Orchestrator-customconfig. First create a new json file by running vi "appsettings.custom.json". Update the json with the configuration desired to set. In this case, use url *.blob.core.usgovcloudapi.net
Example Image:
- Update appsettings with csp policy Buckets.ContentSecuritypolicy. For more information on these configurations, see Configuring appSettings .
- Use the Orchestrator tool, which will merge the newly created json with the Orchestrator-customconfig config map. to update Appsettings, run the below command,
./orchestrator_configurator.sh -c appsettings.custom.json
- To confirm the setting has been applied, run kubectl get cm orchestrator-customconfig -oyaml. This will show the configuration, then see the appsettings field and confirm the configuration being updated.