Zammad Chat Websocket Error - Docker

Infos:

  • Used Zammad version: 3.1.x
  • Used Zammad installation source: docker-compose
  • Operating system: Debian 10.2
  • Browser + version: Chrome 78.0.3904.108

Expected behavior:

  • Chat should open on external website, it does not.

Actual behavior:

  • Chrome DevTools reports Error: “chat.min.js:1 WebSocket connection to ‘ws://xxx.xxx.xxx.xxx/ws’ failed: Error during WebSocket handshake: Unexpected response code: 502”

  • Docker: “zammad-nginx_1 | 2019/12/02 10:11:12 [error] 14#14: *100 upstream prematurely closed connection while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: _, request: “GET /ws HTTP/1.1”, upstream: “http://172.20.0.8:6042/ws”, host: “xxx.xxx.xxx.xxx””

Steps to reproduce the behavior:

  • Install Zammad with docker-compose on fresh Debian 10.2 installation, configure Chat channel with JS code on web page and refresh.

Please provide your nginx’s configuration for the affected vHost. :slight_smile:

It’s the stock standard config which was deployed via docker-compose

#
# this is the nginx config for zammad
#

upstream zammad-railsserver {
    server zammad-railsserver:3000;
}

upstream zammad-websocket {
    server zammad-websocket:6042;
}

server {
    listen 80;

    # replace 'localhost' with your fqdn if you want to use zammad from remote
    server_name _;

    root /opt/zammad/public;

    access_log /dev/stdout;
    error_log  /dev/stdout;

    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;
    }
}

You’re exposing your nginx-container directly to the internet without any NAT magic?

What happens if you curl http://127.0.0.1:3000?
Also

looks a bit off to me, because the upsteam shouldn’t contain /ws from my understanding

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