nioc / xmpp-web

Lightweight web chat client for XMPP server
GNU Affero General Public License v3.0
140 stars 20 forks source link

local.js websocket address #127

Closed paulo-roger closed 2 months ago

paulo-roger commented 2 months ago

Describe the bug

When I access the app it doesnt use the correct wss address.

this is my local.js in the docker container: image

and this is what is being served to the browser: image

I have no idea how to fix it.

Steps to reproduce

~/xmpp/xmpp-web$ cat docker-compose.yml version: "3.4" services: xmpp-web: image: nioc/xmpp-web:latest ports:

Expected behavior

to serve the app with correct ws address

Relevant log

xmpp-web-1  | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
xmpp-web-1  | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
xmpp-web-1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
xmpp-web-1  | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
xmpp-web-1  | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
xmpp-web-1  | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
xmpp-web-1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
xmpp-web-1  | 20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/default.conf.template to /etc/nginx/conf.d/default.conf
xmpp-web-1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
xmpp-web-1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/998-update-local.js.sh
xmpp-web-1  | update local.js with environment variables... done
xmpp-web-1  | /docker-entrypoint.sh: Configuration complete; ready for start up
xmpp-web-1  | 2024/08/01 04:56:17 [notice] 1#1: using the "epoll" event method
xmpp-web-1  | 2024/08/01 04:56:17 [notice] 1#1: nginx/1.26.0
xmpp-web-1  | 2024/08/01 04:56:17 [notice] 1#1: built by gcc 13.2.1 20231014 (Alpine 13.2.1_git20231014)
xmpp-web-1  | 2024/08/01 04:56:17 [notice] 1#1: OS: Linux 5.15.0-1059-oracle
xmpp-web-1  | 2024/08/01 04:56:17 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
xmpp-web-1  | 2024/08/01 04:56:17 [notice] 1#1: start worker processes
xmpp-web-1  | 2024/08/01 04:56:17 [notice] 1#1: start worker process 38
xmpp-web-1  | 2024/08/01 04:56:17 [notice] 1#1: start worker process 39
xmpp-web-1  | 2024/08/01 04:56:17 [notice] 1#1: start worker process 40
xmpp-web-1  | 2024/08/01 04:56:17 [notice] 1#1: start worker process 41
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:04:58:28 +0000] "GET / HTTP/1.1" 200 584 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "172.68.19.53"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:06:21:40 +0000] "GET / HTTP/1.1" 200 584 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "162.158.126.8"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:06:21:41 +0000] "GET / HTTP/1.1" 200 584 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "162.158.126.187"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:06:21:42 +0000] "GET /favicon.ico HTTP/1.1" 200 15086 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "162.158.126.181"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:06:21:43 +0000] "GET / HTTP/1.1" 200 584 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "162.158.126.206"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:06:21:44 +0000] "GET / HTTP/1.1" 200 584 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" "162.158.126.161"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:06:59:05 +0000] "GET / HTTP/1.1" 200 584 "-" "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Mobile Safari/537.36" "172.68.119.186"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:09:36:03 +0000] "GET /wp-admin/setup-config.php?step=1 HTTP/1.1" 200 584 "http://xmpp-web.harpia.red/wp-admin/setup-config.php?step=1" "Mozilla/5.0(Linux; Android 5.1.1; SM-J111F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.90 Mobile Safari/537.36" "172.70.143.226"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:09:36:04 +0000] "GET /wordpress/wp-admin/setup-config.php?step=1 HTTP/1.1" 200 584 "http://xmpp-web.harpia.red/wordpress/wp-admin/setup-config.php?step=1" "Mozilla/5.0 (Linux; Android 5.1.1; SM-J111F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.90 Mobile Safari/537.36" "172.70.143.226"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /server.key HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.103.23"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /database.sql HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.183.44"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /.aws/credentials HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.99.118"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /phpinfo.php HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.98.205"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /etc/shadow HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.94.61"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /.vscode/sftp.json HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.183.131"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /cloud-config.yml HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.70.46.212"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /feed HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.98.138"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /backup.tar.gz HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "141.101.76.31"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /.kube/config HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.70.47.72"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /.ssh/id_ed25519 HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.183.128"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /backup.sql HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.70.47.68"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /server-status HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.183.124"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /.svn/wc.db HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "141.101.76.17"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /docker-compose.yml HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "141.101.76.228"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /api/.env HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.70.46.118"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /web.config HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.99.174"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /config.yaml HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.183.35"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /config.yml HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.70.47.52"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /config.xml HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.95.4"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /.env HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.182.36"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /user_secrets.yml HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.182.77"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET / HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.183.34"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /secrets.json HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "141.101.76.17"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /dump.sql HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.183.129"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /.git/HEAD HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.99.173"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /etc/ssl/private/server.key HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.182.35"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /.env.production HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.98.22"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /config.php HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.70.46.213"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /.ssh/id_ecdsa HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.182.77"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /config/production.json HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.183.36"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /wp-admin/setup-config.php HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.183.40"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /.ssh/id_rsa HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.71.102.217"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /backup.zip HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.70.46.147"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /config.json HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.70.47.129"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:10:08:09 +0000] "GET /config/database.php HTTP/1.1" 200 584 "-" "Go-http-client/1.1" "172.68.196.191"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:12:40:51 +0000] "GET / HTTP/1.1" 200 584 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "172.69.11.251"
xmpp-web-1  | 172.22.0.1 - - [01/Aug/2024:12:41:47 +0000] "GET / HTTP/1.1" 200 584 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" "172.68.19.175"

local.js configuration

No response

XMPP-web version

latest

Installation

Docker image

XMPP server(s)

ejabberd

Browser(s)

Firefox

Device(s)

desktop

Other information

No response

nioc commented 2 months ago

Hello, your docker logs shows strange http requests (wp, ssh, …) but none on local.js.

Can you clear your browser cache (this app is a pwa with strong cache mechanism) and retry?

Check that browser is requesting fresh version of local.js file on network tab.

paulo-roger commented 2 months ago

it is weird because I had purged cloudflare cache and was always reloading with CTRL + F5, sometimes manually cleaning browser cookies, and even tried from a different browser I hadn't previously used.

So I did a sudo docker volume prune -f and docker system prune and sudo docker image prune -a -f to start fresh. now it works. It seems to be only using the env vars from the first run. even though the local.js inside the container still changes.

paulo-roger commented 2 months ago

So in conclusion, now it is working as expected, with a new fresh container.

paulo-roger commented 2 months ago

by the way, last no the least, thank you so much for you fast and prompt response willing to help me. you are awesome!

paulo-roger commented 2 months ago

Sorry, I think it is some problem with cloudflare actually. serving the app in the same domain loads the old local.js.

Even when I purge the cache in cloudflare.

nioc commented 2 months ago

I'm not an expert in cloudflare stuff, probably caching system, but if your problem is solved, it is good for me 😉

paulo-roger commented 2 months ago

yeah it is all good :) ty so much!

paulo-roger commented 2 months ago

If someone ever have this kind of problem add this cache rule to cloudflare:

image