CORS settings
Last updated
Last updated
CORS
stands for Cross Origin Resource Sharing
and is a standard approach that browsers use to apply some security so that only a fixed set of resources can be used for a specific page.
Lets imagine our website, which is on https://www.wbb.ai
is trying to load resources from a different website, https://webuildbots.ai
. Although we might know that this is okay, because the domains do not match in a lot of cases this will be blocked by the browser. If it is blocked you will get an error in the browser console and anything provided by that resource won't be present.
If you get an error in the browser, it'll look something like this :
Access to XMLHttpRequest at 'https://backend.logicdialog.ai/api/user/client-info?userSid=undefined&language=en&client=wbb&domain=www.wbb.ai&pageUrl=https%3A%2F%2Fwww.wbb.ai' from origin 'https://www.wbb.ai' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Fortunately, if you see an error like that there is an easy way of fixing it.
From the settings page in Logicdialog there is a Web Plugin
section and within this you'll see a section for CORS Settings
. This list might already be populated with existing configuration values, however it may also be empty if this is a new bot.
To add a new CORS value, click on the Add URL
button at the top right of the screen and enter the domain you wish to allow. In the case of the error above, the domain you'd need to add is https://www.wbb.ai
. Specifically, is the domain shown after the error message says from origin
. Do not include any other parts of the URL of the page, just the domain.
Once you've then saved the values, the chat plugin should work on the page. You can add any number of CORS domains to the settings for cases where you want to have your bot on multiple websites.
For more information, please see the CORS page on Wikipedia.