Hi, When I connect my Rasa chatbot to MS Teams through ngrok, it functions perfectly. However, when I switch to using nginx, although the rasa chat widget works well, it fails to appear over HTTPS. Consequently, I’m unable to integrate it with Teams.
To make Rasa Webchat work with NGINX and HTTPS, you need to configure several parts correctly:
Steps Overview:
-
Set up your Rasa server
-
Enable CORS and set credentials in
endpoints.yml
-
Serve your webchat widget
-
Use HTTPS with a domain (via NGINX + SSL certificate)
-
Configure NGINX properly
-
Rasa Server Configuration
Edit your endpoints.yml
to allow connections from your frontend (e.g., your domain):
cors:
origin: "https://yourdomain.com"
Ensure credentials.yml
has the REST channel enabled:
rest:
- Use Rasa Webchat
Serve the widget in your HTML:
<script src="https://cdn.jsdelivr.net/npm/rasa-webchat@1.0.1/lib/index.min.js"></script>
<div id="webchat" />
<script>
WebChat.default({
initPayload: "/greet",
customData: {"language": "en"}, // optional
socketUrl: "https://yourdomain.com",
title: "Rasa Bot",
subtitle: "Chat with me!",
}, null);
</script>
Change socketUrl
to your secure Rasa server URL.
- Set Up HTTPS with NGINX
Example NGINX config with SSL:
Install SSL, then use a config like this:
server {
listen 80;
server_name yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name yourdomain.com;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
location / {
proxy_pass http://localhost:5005; # Rasa running locally
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
Make sure Rasa is running with --cors "*" --enable-api
.
You can refer this guide for detailed information : install SSL Certificate on NGINX
Run Rasa server securely
rasa run --enable-api --cors "*" --debug
Test the Setup
- Visit
https://yourdomain.com
in your browser. - Check if the Rasa Webchat widget loads and can chat with the bot.
Hope its clear now.