androidseb25 / iGotify-Notification-Assistent

Docker container for sending Gotify notifications to iOS devices (bridge to gotify websocket)
MIT License
154 stars 6 forks source link

[BUG] Websocket Reconnection failed #109

Open FaSeEngineering opened 1 month ago

FaSeEngineering commented 1 month ago

Describe the bug

I guess its not a bug but a misconfiguration of nginx. However, I struggle to get it working and hope that someone else had this issue as well but solved it. The overall system should be reachable using two public domains:

Therefore, I resolve the first domain to the gotify container and the second one to the igotify one. The initial setup of my device (iPhone 15) seems to work fine. The logs of igotify show:

ClientToken: C_***
DeviceToken: NTFY-DEVICE-***
GotifyUrl: https://gotify.***
Client connecting...
Done!

However, after some seconds the connection seems to be interrupted:

Disconnection happened, type: Error
Webseocket Reconnection failed with Error. Try to reconnect in 10s.

I am pretty sure that my nginx configuration is missing something but I struggle to find the mistake. The config for the i.gotify.***.com domain looks like:

server {
    server_name i.gotify.***.com;
    location / {

        # Reverse Proxy
        proxy_pass         http://127.0.0.1:8681;
        proxy_http_version 1.1;

        # Websockets Support
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_connect_timeout   60s;
        proxy_send_timeout      3600s;
        proxy_read_timeout      3600s;
    }

    # SSL
    listen 443 ssl; # managed by Certbot
    ssl_certificate ***/fullchain.pem; # managed by Certbot
    ssl_certificate_key ***/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

}

Do you have any idea whats wrong or missing? I appreciate your ideas and suggestions.

androidseb25 commented 1 month ago

take a look at you're servername there is the mistake you set igotify.*** but you use i.gotify.***

FaSeEngineering commented 1 month ago

Sorry, that was my mistake by transfering the nginx configuration and changing the server name... the original config is set to i.gotify.***.com. I adjusted my original post.

androidseb25 commented 1 month ago

Did you already tried the default nginx config for igotify from the readme?

proxy_set_header   Host $http_host;
proxy_connect_timeout   1m;
proxy_send_timeout      1m;
proxy_read_timeout      1m;

Did you maybe check you're ufw? At issue #55 someone had the same problem

FaSeEngineering commented 1 month ago

Yes, I started with the default settings from the README but did not have any success on that. Thanks for the reference to issue #55. I investigated it and tried adding ufw rules and disable the firewall but the error message remains. When entering the containers and installing some network tools, I am able to resolve the dns names and ping the containers. Therefore, I think that communication in general should be possible.

androidseb25 commented 1 month ago

After how many seconds the disconnect message comes? Does he try to reconnect with success message?

FaSeEngineering commented 4 weeks ago

About 2s until the message appears. I let it run for a few hours but no successful reconnect during this time.

androidseb25 commented 3 weeks ago

did you found any solution?

FaSeEngineering commented 2 weeks ago

Unfortunately, no... I run out of ideas on what else I could try.