Mobile interface show “The connection to the server is lost”

You should also not use " pnpm run dev:https" or do you want to develop something?
The “dev” is pointing to the “vite” development server. So nothing related to production.

I’m not very familiar with building for production, and I couldn’t find a way to build from the source code in the documentation. I used Vite to build the mobile version, but I couldn’t find a method to build the desktop version.

After executing RAILS_ENV=production bundle exec rails assets:precompile and accessing the IP through NGINX, it returns a 404 error. I used the NGINX configuration from the project and modified the /opt directory path accordingly.

But why do you want to build something? I cannot follow what you are trying to achieve, and I think this is all not expected from our side.

When you have a simple package installation, it should normally work out of the box. Why you want to rebuild the assets? But when you want to rebuild assets:precompileis the way to go.

We have added some new features for internal use, such as a signature pad and exporting PDFs based on ticket information. Because of this, we may need to recompile the project.

Why are you doing so, @YuSensenYa, without gaining the required knowledge about how to deploy your changes? I don’t understand this.

In the community, there is a nice tutorial on how to build add-ons, maybe you should look into this.

I might not have found the relevant documentation. Could you tell me where to find it? I was previously a Java and Python developer, so I may not be very familiar with the build process for this project.

https://community.zammad.org/t/packages-tutorial/12079/14

I am using NGINX as a proxy, but the desktop version is not accessible. I have run rake assets:precompile, and there are compiled files in public/assets/, but accessing the mobile version works fine. This is strange; it stays stuck on the loading page.

This is my NGINX config.‘#

this is an example nginx config for Zammad

Please visit https://docs.zammad.org for further input on how to configure

your nginx to work with Zammad

upstream zammad-railsserver {
server 127.0.0.1:3000;
}

upstream zammad-websocket {
server 127.0.0.1:6042;
}

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

server_name example.com;

security - prevent information disclosure about server version

server_tokens off;

root /opt/zammad/zammad-6.4.1/public;

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

location /.well-known/ {
root /var/www/html;
}

return 301 https://$server_name$request_uri;
}

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

server_name example.com;

security - prevent information disclosure about server version

server_tokens off;

ssl_certificate /etc/ssl/certs/example.com.pem;
ssl_certificate_key /etc/ssl/private/example.com.key;

ssl_trusted_certificate /etc/ssl/certs/root-ca-plus-intermediates.pem;

ssl_dhparam /etc/ssl/dhparam.pem;

ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305;
ssl_prefer_server_ciphers off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 180m;
ssl_session_tickets off;

ssl_stapling on;

ssl_stapling_verify on;

Use your prefered resolver - also allows external like 1.1.1.1 and 8.8.8.8

resolver 127.0.0.1;

add_header Strict-Transport-Security “max-age=63072000” always;

location = /robots.txt {
access_log off; log_not_found off;
}

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

root /opt/zammad/zammad-6.4.1/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|apple-touch-icon.png) {
expires max;
}

legacy web socket server

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

action cable

location /cable {
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-railsserver;
}

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;

# change this line in an SSO setup
proxy_set_header X-Forwarded-User "";

proxy_read_timeout 180;
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;

}
}

Sorry, I am not able to help. I think your system is somehow misconfigured. Maybe you should nuke it and start from scratch with the steps from the documentation.

I have some confusion about the NGINX template. Shouldn’t the requests to /cable be on WebSocket port 6042? Why is it using port 3000? I am using the zammad official NGINX configuration, but with a self-signed certificate, it still can’t connect. Please see the image below.

ActionCable is using the puma for the connection :slight_smile:

Thank you! I understand this now. However, after installing and starting using cd /opt/zammad/script/systemd $ ./install-zammad-systemd-services.sh and using the NGINX template, it seems that Zammad isn’t running properly. Is there any documentation that can guide me on which configurations I should pay attention to? I’ve observed that the /cable endpoint seems to be connecting to Redis. I’m also facing issues with images and am not sure how to resolve them.

Thank you! I just found the issue in the production.log file. The path I forwarded with NGINX was being blocked in zzz_action_cable_preferences.rb. I didn’t fully understand the principle, but allowing it in request_origins made it work normally.

production.log
ERROR – : Request origin not allowed: https://192.168..

DO NOT change these files. They are a safety measure.
This is not a solution, but potentially a security issue or breaks behavior of Zammad.

Fix your goddamn configuration instead of source code files.

Hmm, I also don’t want to modify the source code files, but it seems I can’t find another solution. I feel like the issue might be that I didn’t configure the proxy correctly in NGINX. It seems to be an NGINX configuration problem where it fails to properly forward https://192.168.10.* to http://127.0.0.1, preventing zzz_action_cable_preferences.rb from running the service correctly.

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