mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 16:35:53 +02:00
[GH-ISSUE #888] iOS notifications not working on 5G, but works on Wi-Fi #630
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#630
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @davidamacey on GitHub (Sep 17, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/888
🐞 Describe the bug
iOS App has different results between WiFi and Cell network (5G) connections.
Setup: Locally hosted docker image, routed through cloudflare tunnel with my domain name (as described by networkChuck)
Unable to subscribe to new topics unless I enter the locally hosted server IP address on local Wi-Fi then subscribe to topic. Then I change the server URL to my ntfy..com, and it works with the subscribed topic (on Wi-Fi). When using my personal URL the iOS app waits and then says "Request timed out"
When subscribed to channels on my ntfy..com server I do not get notifications over 5G, but when I am connected to the local Wi-Fi notifications are instant. When switching back to Wi-Fi I instantly receive all my test messages pushed at once, otherwise nothing happens on 5G.
💻 Components impacted
iOS Application
💡 Screenshots and/or logs
No error logs at this time.
🔮 Additional context
@Haitham-ghaida commented on GitHub (Sep 21, 2023):
Hi,
I have a very similar setup. Everything works for me. Although I did have issues setting it up so maybe I can help.
A) did you setup a server.yml file in /etc/ntfy ? if not do that and when running the docker image you have to pass it like this docker run -v /var/cache/ntfy:/var/cache/ntfy -v /etc/ntfy:/etc/ntfy -p 80:80 -itd binwiederhier/ntfy serve --cache-file /var/cache/ntfy/cache.db
B) if you setup the server.yml file then remember to uncomment the bit where it says ios notifications.
C) in the server.yml file do not use the local IP. use the actual domain name so HTTP://ntfy.yourdomain.com
@davidamacey commented on GitHub (Sep 21, 2023):
@Haitham-ghaida Thank for the response.
A) I used a docker compose file, only difference is I mapped the cache and etc to a permanent folder for saving information between instances
B) Yes I created the server.yml file and edited the base url to the local host IP address.
C) I tried both local IP and the cloudflare url http://ntfy.mydomain.com, but I got the same effect. I wonder if there is a setting I am missing in cloudflare. The tunnel is a CNAME and the docker image locally says its healthy in cloudflare. Are there any additional settings in cloudflare?
@LogicalSoIutions commented on GitHub (Sep 25, 2023):
Having similar issues ~ Everything was just fine for 4-5 days. Also setup on a Docker Container w/ CF Tunnel.
Now, I just got the "New Message" notification and nothing else. Even force reloading the app doesn't pull in new data.
Edit: Just changed my server IP to ntfy.sh instead of my self hosted server and now the messages are coming through just fine. Something must be messed up on NTFY backend side for the upstream?
@Haitham-ghaida commented on GitHub (Sep 25, 2023):
@davidamacey
I doubt it's a Cloudflare issue. like I found that having tiny mistakes in the config file can miss the whole thing for me I added HTTP:ntfy.website.com/ instead of HTTP:ntfy.website.com so just the "/" was enough to mess things up.
Make sure the upstream server for IOS is configured correctly.
@LogicalSoIutions
Mine has been working fine for one week now. But I did notice a small lag for IOS.
Sorry, I couldn't help further.
@LogicalSoIutions commented on GitHub (Sep 25, 2023):
Without changing ANYTHING - it just started to work ~1 hour ago.
@davidamacey commented on GitHub (Sep 27, 2023):
All, thank you for the responses. I am still troubleshooting.
Tests:
From Cloudflare Tunnel Logs:
This is when I attempt to post a message:
curl -d "hi test" https://ntfy.mydomain.com/test01Docker-compose file
I wonder if there is a mismatch with the routing between the cloudflare container and the internal configuration of ntfy container? As it seems I have followed all of the documentation and tutorials. Did I miss something?
@wunter8 commented on GitHub (Sep 28, 2023):
First, change your base-url to include "https" instead of just "http".
Next, I'm not very familiar with Cloudflare, but if it and ntfy are running in docker containers, I'm pretty sure you need to make sure they are on the same docker network so that they can communicate. I also think that docker containers on the same network communicate using internal ports (80 in this case), instead of the exposed port (81).
@LogicalSoIutions commented on GitHub (Sep 28, 2023):
Sigh... Yea... This is frustrating. Probably just going back to Twilio SMS. This is too inconsistent on iOS.
Just randomly broke again.
@wunter8 commented on GitHub (Sep 28, 2023):
Have any of you tried the PWA on iOS instead of the native app? People have much more success with the PWA
@LogicalSoIutions commented on GitHub (Sep 28, 2023):
I have not yet due to having too many devices that we use these notifications for.
I just am confused as to why things work when I use https://ntfy.sh as the server and test
curl -H "Title: This is a test" -H "Priority: 5" -H "Tags: warning" -d "This is a sample message" https://ntfy.sh/diff~ workscurl -H "Title: This is a test" -H "Priority: 5" -H "Tags: warning" -d "This is a sample message" https://ntfy.mydomain/diff~ gives generic "New Message" notification with no data showing relating to the alert.I just don't get why this works for a few hours and then breaks without any config changes.
@wunter8 commented on GitHub (Sep 28, 2023):
The native iOS app is known to be buggy. The iOS PWA works much better
With your specific example, sending messages with priority headers has been known to cause problems with iOS, particularly with Cloudflare. A fix for this specific issue has been made and should be released in the next version
@davidamacey commented on GitHub (Sep 28, 2023):
Hi Everyone, I really appreciate the conversation and feedback!
I believe I have figure it out! It has to do with cloudflare tunnel docker container hitting the ntfy docker container.
Steps to configure
docker-compose up -dNotes for why to setup this way
Based on the cloudflare error, stating it cannot resolve the ntfy docker IP address; it actually cannot because they were run on different docker networks.
By setting the url in cloudflare, we are using the container dynamic IP of ntfy, docker will automatically resolve the local docker container IP of ntfy.
By doing this setup I am able to run ntfy in a container on my home server with instant notifications:
Tests:
Both instances generate an automatic notification on my iOS phone which is NOT connected to my home WiFi, using 5G
Repo
In order to share my code more easily I created a simple repo with my docker-compose setup
run_ntfy
Please feel free to clone the repo to setup your ntfy on your home server!
For those that just want the file
@wunter8 commented on GitHub (Sep 28, 2023):
Yay! I'm glad you got it working! And thank you for the thorough instructions. Hopefully they are helpful to others
By the way, you should be able to use https://ntfy.mydomain.com everywhere; you shouldn't ever have to use ntfy server IP
@davidamacey commented on GitHub (Sep 28, 2023):
@wunter8 Thank you for the follow up.
Correct the url of https://ntfy.mydomain.com will work outside the network. I was suggesting the serverip/topic as a test example to ensure the topics were actually showing up on the local server before going external.
Thanks again!
@z3k0sec commented on GitHub (Oct 24, 2023):
@davidamacey I have the exact same setup, but notifications are not working for me.
@binwiederhier commented on GitHub (Nov 20, 2023):
Folks, apologies that you are having issues. iOS selfhosted is a bit tricky, and there are still a few issues. I have not read through the entire thread, but here are some pointers.
upstream-base-urlmust be configured to match exactly what you have configured as a default base URL in your iOS app. Otherwise messages will not arrive at all. See https://docs.ntfy.sh/config/#ios-instant-notificationsIn general, troubleshooting like this is best done via Discord/Matrix.
I am closing this for now, because OP got their issues resolved, but I am happy to chat about other issues in chat or in other tickets.