Multi-domain support from one botpress server

Hello

I see that I can create number of different bots in one Botpress server.
However I see this as close to impossible to embed these bots in more than one domain.
If I install my website and botpress to one and the same host then I can embed the iframe and all works fine. But if I want to use another bot in another web site then how this works?
Is this possible at all? I tried to embed bot deployed to VM on one server to website on another and I got CORS related errors.
Also seems white listing of domains with allow-from is not anymore an option.

Best regards
Sven

You should set the CORS configuration in your botpress.config.json to true and origin to "*".

Hi Sylvain

Thanks for your help!
The settings helped. When I run the bot embed script on my local server via http the cors error is not there anymore. However on my website via https it gives the https vs http protocol error even with this setting. Seems it is time to configure a nginx server to redirect 443 to 3000 port.
I have 2 additional questions:

  1. Do I need to set any configuration in NGINX related to CORS errors in this case? Because this time for my website this will be the remote host.
  2. Do you have any sample NGINX config for https to http redirect on the same host?

Thanks again for your help!

Best regards
Sven

HI Sven,

It was good e-meeting you the other day.
@sylvain @spgin @allardy Just wanted to ping you guys for help. Sven would really much appreciate your help, this is the only thing preventing him of going live for the moment.

Happy Bot deployment!
JB

Thanks JB

Update on my side. I trying to configure NGINX reverse proxy and attached is my test configuration. I use self-signed certificate. Still I cannot make it work. When I request https url it hangs and timeouts. When I test the nginx configuration all is OK. The service stops and starts correctly and port 80 is working. Any advice is welcome.

Best regards
Sven

Hi @Uname123, https is not handled by Botpress out of the box, so definitely you will need an NGINX server in front of it.

We have a sample configuration in the documentation here: https://botpress.io/docs/advanced/hosting#secure-configuration-for-the-nginx-server

Let me know if that helps!

Hi Allardy

Thanks for your help!
I did not see this configuration before and it gives me some ideas which I am going to try.
However correct me if I am wrong but look like this is config for same domain website and botpress/nginx. In my case I need to request botpress from another domain. Please let me know your opinion.

Best regards
Svetlin

Hi Yann

Thanks for your help I moved forward and one last step needs to be done to complete the NGINX as reverse proxy. Currently all https requests are processed fine and properly redircted to localhost:3000. The java script loads with no issue too. The last problem I have is to load the iframe. Still it fails with cors errors. I added the following in my nginx config file:

. However it did not help. I understand this is not secure but I am just trying to make it work. Then I will properly fix this part. So here is my request - could you help me to figure out the nginx CORS setting for multi-domain botpress config?

Best regards
Sven

Hi Yann

I was thinking this will be the last issue however I was wrong:) so now the iframe loads with a few changes in the cors config. But I still cannot load completely the iframe because of the below error I get:
Refused to display ‘https://github.com/botpress/botpress/tree/master/docs’ in a frame because an ancestor violates the following Content Security Policy directive: “frame-ancestors ‘none’”.

As I cannot change the cors settings for github what is your advice as next steps? Also I am not sure how the loading of this docs helps to the bot to operate. Please let me know your opinion here.

Best regards
Sven

Hi @Uname123, I am a bit puzzled by the error you have about the github url. I can’t find where it comes from. Are you loading the embedded-webchat example ? Is there a link you can provide me (in private) so I can check?

Otherwise, I would need to setup an environment to try it out

Hi Yann

I can provide you with test URL. I am looking how to send message in private but I cannot see this on my side. Could you give a hint how to do this?
In the meantime here is the html I use. All other resources are getting loaded fine. just the above error comes at the end.
image

Thanks a lot for your help!

Best regards
Svetlin

Hi, you can click on my name, then Message. You can check your messages when clicking on your profile in the upper right corner (there’s an envelope)

@Uname123 I believe the issue you are facing is a browser security measure. If your website is hosted on somewebsite.com, and you try to load other resources over 127.0.0.1, the browser prevents it.

The best solution would be to configure NGINX to answer requests on somewebsite.com/bot and redirect them under the hood to 127.0.0.1.

Note that you can change the root path of the server (ex: /bot) so the redirection can be made for all requests matching /bot

Hi Yann

As additional info, in my NGINX config I redirect to the IP and not localhost IP or localhost itself. I saw the envelope in my profile but I dont see one in front of yours. Could you send me test forum message or reply to the mail forwarded by JB? In this email I provided you with test link. Looking at the screenshot below seems almost everything loaded successfully and we just have to find from where the github link is coming in the game:

Best regards
Sven

Hi Sven,

Are you saying you don’t see the blue Message button, as seen on this screenshot?

Thanks
JB

Hi JB

Unfortunately by some reason this is not visible for me:
image

Best regards
Sven

Hi Sven,

That is strange. I change something, Can you confirm if it works now?

Thanks
JB