Botpress webchat connect to secure websocket (wss)

Hi all,

I am having issues connecting my Botpress webchat to my Botpress server.
The webchat is integrated in an HTTPS web page and Botpress server’s external URL is also in HTTPS. Finally, here is my integration script:

/* Script called from "https://my-web-page.domain.com" */
window.botpressWebChat.init({
    host: "https://my-botpress-server.domain.com",
    botId: "mybotid"
})

And I have the following error :

Mixed Content: The page at 'https://my-web-page.domain.com/' was
loaded over HTTPS, but attempted to connect to the insecure WebSocket
endpoint 'ws://my-botpress-server.domain.com/sockjs-node'. This
request has been blocked; this endpoint must be available over WSS.

Is there a way to configure Botpress’ websocket to be WSS ?
Thanks in advance !

@cengizmurat I think you need to use the same http version in your proxy/load balancer.

Nginx example:

# We need to add specific headers so the websockets can be set up through the reverse proxy
		location /socket.io/ {
		  proxy_pass http://localhost:3000/socket.io/;
		  proxy_http_version 1.1;
		  proxy_set_header Upgrade $http_upgrade;
		  proxy_set_header Connection "Upgrade";
		}
# All other requests should be directed to the server
		location / {
			
		  #root   html;
		  #index  index.html index.htm;
		  proxy_read_timeout 120;
		  proxy_pass http://botpress;

		  proxy_set_header X-Forwarded-For $remote_addr;
		  proxy_set_header Host $http_host;
		  proxy_http_version 1.1;
		  proxy_set_header Upgrade $http_upgrade;
		  proxy_set_header Connection "upgrade";
		}

Check out my blog below for more tutorials on Botpress.

Hi @cengizmurat, if your EXTERNAL_URL is configured correctly, the backend should automatically use wss for socket connections, otherwise it will listen on ws