Chat Integration is not working

Infos:

Description:

I have integrated the live chat code given me on my zammad instance located at support.domain.tld and put on my website at domain.tld. Both websites have a ssl certificate and I am using https.

Problem:

Now when I want to open my website the widget isn’t showing up. I am online as agent but the chat isn’t showing up, I get the message

WebSocket connection to 'wss://domain.tld/ws' failed: Error during WebSocket handshake: Unexpected response code: 404

Here I was wondering why domian.tld is showing up as my zammad instance is located at support.domain.tld.

My Nginx .conf:

#
# this is the nginx config for zammad
#

upstream zammad-railsserver {
server 127.0.0.1:3000;
}

upstream zammad-websocket {
server 127.0.0.1:6042;
}

server {

# replace 'localhost' with your fqdn if you want to use zammad from remote
server_name support.domain.tld;

# security - prevent information disclosure about server version
server_tokens off;

root /opt/zammad/public;

access_log /var/log/nginx/zammad.access.log;
error_log  /var/log/nginx/zammad.error.log;

client_max_body_size 50M;

location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico) {
   expires max;
    }

location /ws {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header CLIENT_IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_read_timeout 86400;
    proxy_pass http://zammad-websocket;
}

location / {
    proxy_set_header Host $http_host;
    proxy_set_header CLIENT_IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_read_timeout 300;
    proxy_pass http://zammad-railsserver;

    gzip on;
    gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
    gzip_proxied any;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/support.simple-crypto.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/support.simple-crypto.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}


server {
if ($host = support.simple-crypto.net) {
    return 301 https://$host$request_uri;
} # managed by Certbot


listen 80;
server_name support.simple-crypto.net;
return 404; # managed by Certbot


}

Looks like the detection of the Zammad instance fails.
Please provide the wdiget configuration of the chat you put on your website.

Other wise helping you is impossible.

I took the standard configuartion given me by zammad.
I don’t know if that could be the reason, but I use cloudflare

<script src="https://support.simple-crypto.net/assets/chat/chat.min.js"></script>  <script>
  $(function() {
   new ZammadChat({
    fontSize: '12px',
    chatId: 2,
    debug: true
   });
  });
</script>

Ok, I found the solution by setting the host in my chat configuration. Thank you :slight_smile:

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.