Hi @nik202 , I’ve been using Rasa webchat using a custom connector on localhost. Rasa server runs on localhost:5005 and I’m also able to see it properly when I define localhost:5005 as the socketUrl in my frontend. Now, I want to use ngrok and so I copied the ngrok https Url and pasted it as the value for socketUrl properly in my frontend. However, the webchat widget doesn’t show up with ngrok while it was working perfectly fine with localhost. Please help
@webdev-rohit can you share some steps with screenshot and what you are currently doing in steps?
Steps 1: Created a custom channel file for socketio connection and named it in the format - filename.Inputclassname in credentials.yml:
- Ran rasa server locally i.e. localhost:5005 and in my frontend gave the socketUrl as:
This gives proper output i.e. I’m able to see my webchat widget in browser and also communicate with it.
- Then, I forwarded port 5005 to ngrok using - ngrok http 5005 command. And changed the socketUrl as show in one of the above screenshots to the newly provided ngrok https Url. The widget doesn’t show up in the browser. This is my issue @nik202
@webdev-rohit Ok means whilst using ngrok and copying the ngrok https inside socketUrl you are not able to run the widget. If yes follow these steps:
- Create the ngrok account
- Download the ngrok for your machine
- Connect and authenticate the tokens
- Run the ngrok using command: ngrok http 5005
- paste the https generated link inside socketUrl
I hope this will help you.
Okay, thanks @nik202 , will try this and see if it works out or not
@webdev-rohit it should work, you doubt? do share the ngrok console output ok?
@webdev-rohit is this issue solved? if yes please close this thread as solution.
No, it is not. But, I’m not actually researching more about it now. I’ve switched anyway to deploying rasa x in kubernetes.
when running rasa locally and forwarding with ngrok I had the same issue. By inspecting the page I found out, that it was an CORS error - did you check that?
Access to XMLHttpRequest at 'https://xxxx-xxx-xxx-xx.ngrok.io/socket.io/?EIO=4&transport=polling&t=N-85pBG' from origin 'https://xxx.de' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET https://xxxx-xxx-xxx-xx.ngrok.io/socket.io/?EIO=4&transport=polling&t=N-85pBG net::ERR_FAILED 404
I my case (hosting the website on Siteground) the solution was -as explained here:
In cases where cross-domain scripting is needed, add the following rule in your website’s .htaccess file:
<ifModule mod_headers.c> Header set Access-Control-Allow-Origin: * </ifModule>
This header will instruct web browsers on how to use and manage the cross-domain content. The browser then allows access to the content based on its security configuration.
N.B. The above rules will only work if NGINX Direct Delivery is disabled. You can deactivate the service from Site Tools → Speed → Caching.
I also needed to clean the cache for the website and I need to redo it everytime I restart ngrok/rasa.
Maybe that helps you?
Okay, @vio_lovis will surely try doing this sometime and inform here if it works