Enable Chat on external Website

Hi,

I do run zammad on a hyperV Box behind a another hyperV nginx reverse proxy. The reverse proxy is exposed via the port 443.
So zammad is available via mysubdomain.domain.tld. I’d like the chat be available on my domain.tld which is hosted somwhere else.

I integrated like documented.

The network tab says a 502 error wss://subdomain.domain.tld/ws

on my zammad machine I can logon to the socket with: “wscat -c ws://subdomain.domain.tld/ws” and “wscat -c ws://localhost:6042”

on the reverse proxy machine wscat fails with error 502

Is that because the websocket is bind to localhost/172.0.0.1 ?

I did follow https://docs.zammad.org/en/latest/appendix-configure-env-vars.html, but either I did it wrong somehow, or it doesn’t work for me.

Any other suggestions of solving?
Thanks!

Please provide both nginx-configuration files, other wise we won’t be able to help you.

Hi,
thanks for the quick reply.

zammad machine:

this is the nginx config for zammad

upstream zammad-railsserver {
    server localhost:3000;
}

upstream zammad-websocket {
    server localhost:6042;
}

server {
    listen 80;

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

    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-$
        gzip_proxied any;
    }
}

reverse proxy:

server {                                                                                                                         
        listen 80;                                                                                                               
        server_name subdomain_2.domain_2.tld; 
        return 301 https://$server_name$request_uri;                                                        
      }    
server {
        listen 80;                                                                                                               
        server_name subdomain.domain.tld; 
        return 301 https://$server_name$request_uri;                                                        

}	  
# Zammad
server {                                                                                                                          
        listen 443 ssl;                                                                                 
        server_name subdomain.domain.tld; # Domain für die erste Web-Applikation  

        ssl on;  
		ssl_certificate /etc/letsencrypt/live/subdomain.domain.tld/fullchain.pem;
		ssl_certificate_key /etc/letsencrypt/live/subdomain.domain.tld/privkey.pem;
       
        error_page 497 = https://$server_name:$server_port$request_uri;  

        location /  
               {          
                proxy_set_header X-Real-IP  $remote_addr;   
                proxy_set_header X-Forwarded-For $remote_addr;  
                proxy_set_header Host $host;  
                proxy_pass http://10.0.x.x; # Interne IP <-- Server 1
               }
}
# Server 2
server { 
        listen 443 ssl; 
        server_name subdomain_2.domain_2.tld; # Domain für die erste Web-Applikation

        ssl on; 
		ssl_certificate /etc/letsencrypt/live/subdomain_2.domain_2.tld/fullchain.pem;
		ssl_certificate_key /etc/letsencrypt/live/subdomain_2.domain_2.tld/privkey.pem;

        error_page 497 = https://$server_name:$server_port$request_uri;  
                         
        location /                           
               {                               
                proxy_set_header X-Real-IP  $remote_addr;    
                proxy_set_header X-Forwarded-For $remote_addr;   
                proxy_set_header Host $host;                    
                proxy_pass http://10.0.x.x; # Interne IP <-- Server 2
               }                                       
} 

Thanks!

Hi,
does not anybody have the chat feature enabled on a similar infrastructure like me?

What do your conf look like?

If not, what do you suggest to change? Is my setup unable to pass the chat?
Thanks!
Happy Holidays!

1 Like

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