How do I make rasa webchat work with nginx and https?

I have a chatbot implemented with rasa and it is working with rasa webchat. It worked fine when I tested it locally with ngrok, and it also worked when I configured nginx (port 80) on the server. However, once I changed the nginx config file to support https, the webchat only shows the “Connecting…” message and does not respond. I looked for errors in the browser console but there are none. This is my index file which takes care of the webchat interface:

<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <div id="webchat">
    <script src=""></script>
            selector: "#webchat",
            initPayload: "hi",
            interval: 1000,
            socketUrl: "",
            socketPath: "/",
            title: "speak with bot",
            inputTextFieldHint: "say something...",
            connectingText: "Connecting...",
            connectOn: open,
            embedded: true,
            hideWhenNotConnected: false,
            /*fullScreenMode: true,*/
            profileAvatar: "assets/fe.jpeg",
            openLauncherImage: 'assets/launcher_button.svg',
            closeLauncherImage: 'assets/launcher_button.svg',
            params: {
                images: {
                    dims: {
                        width: 300,
                        height: 200,
                storage: "session"


and this is my nginx config file after proper modifications to support https:

upstream rasa {
        server bot-webchat:5005; # bot-webchat is the chatbot container name

server {
        listen 80;
        listen [::]:80;


        location ~ /.well-known/acme-challenge {
                allow all;
                root /var/www/html;

        location / {
                rewrite ^ https://$host$request_uri? permanent;

server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;

        index index.php index.html index.htm;

        root /var/www/html;

        server_tokens off;

        ssl_certificate /etc/letsencrypt/live/;
        ssl_certificate_key /etc/letsencrypt/live/;

        ssl on;
        ssl_session_cache  builtin:1000  shared:SSL:10m;
        ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
        ssl_prefer_server_ciphers on;

        location / {
                try_files $uri $uri/ =404;

        # the next two location directives were necessary to avoid mixed content error and allow
        # https access to port 5005 and websocket
        location /rasa/ {
                proxy_pass http://rasa;
                proxy_http_version  1.1;
                proxy_set_header Upgrade           $http_upgrade;
                proxy_set_header Connection        "upgrade";
                proxy_set_header Host              $host;

        location / {
                proxy_pass http://rasa/;
                proxy_http_version  1.1;
                proxy_set_header Upgrade           $http_upgrade;
                proxy_set_header Connection        "upgrade";
                proxy_set_header Host              $host;

        location = /favicon.ico {
                log_not_found off; access_log off;

        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
                expires max;
                log_not_found off;

After the tests I’ve done I believe there may be something wrong in my nginx config file, but I have no idea what that is… I also used postman to verify that “” and “” are responding as expected. If someone can help me figure what is going on, I’d really appreciate it.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


Have you checked your Nginx error log at /var/log/nginx/error.log?

I would suggest following the steps here on how to troubleshoot common Nginx problems: