Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No more IOS push notification since July 2024 #1191

Open
GuillaumeDebernard opened this issue Sep 29, 2024 · 36 comments
Open

No more IOS push notification since July 2024 #1191

GuillaumeDebernard opened this issue Sep 29, 2024 · 36 comments
Labels
🪲 bug Something isn't working

Comments

@GuillaumeDebernard
Copy link

Quick description

I have NTFY running with docker-compose, behind an nginx reverse-proxy with https (certbot).
Since mid-July, I no longer receive notifications on IOS, which used to work fine.

The requests I send look like : curl -d Hello https://ntfy.myDomain.com/myTopic.

Note that reverse-proxy is used for other services and work perfectly fine for them.

I didn't see any trace log about usage limits.

What's still working

  • Notifications on Android phones
  • Notifications on WebApp (Chrome & Safari at least)
  • Notifications arrives on IOS if you refresh the app (by pulling down)
  • Push notification to IOS with https://ntfy.sh/myTopic

What I tried, and didn't work

  • Run a previous ntfy version
  • Prune docker image and rebuild it
  • Switch from server.yml to env variables for configuration
  • Switch from https://myDomain.com/services/path/to/MyTopic to subdomain : https://ntfy.myDomain.com/myTopic (It allow me to acces webapp by the way)
  • Uninstall/reinstall the app + remove app from Icloud backup
  • Restart Iphone
  • Unsuscribe/resuscribe to topics
  • A lot of nginx configuration for the redirections

My configurations

  • NTFY_BASE_URL match exactly the default server I set up in my app.

docker-compose.yaml file

ntfy:
  image: binwiederhier/ntfy:latest
  container_name: ntfy_container
  command:
    - serve
  environment:
    TZ: "Europe/Paris"
    NTFY_BASE_URL: https://${SUB_NTFY}
    NTFY_LISTEN_HTTP: :${NTFY_PORT}
    NTFY_CACHE_FILE: /var/cache/ntfy/cache.db
    NTFY_ATTACHMENT_CACHE_DIR: /var/cache/ntfy/attachments
    NTFY_UPSTREAM_BASE_URL: https://ntfy.sh
    NTFY_LOG_LEVEL: warning
    NTFY_LOG_FORMAT: text
    NTFY_LOG_FILE: var/ntfy/logs.log
    NTFY_KEEPALIVE_INTERVAL: 45s
    NTFY_BEHIND_PROXY: true
    NTFY_WEB_ROOT: /app
  volumes:
    - ./utils/ntfy/cache:/var/cache/ntfy
    - ./utils/ntfy:/var/ntfy
  ports:
    - "${NTFY_PORT}:${NTFY_PORT}"
   # Work the same if using port 80
  networks:
    - main

Nginx default.conf.template file

server {
  listen ${HTTPS_DEFAULT} ssl http2;
  listen [::]:${HTTPS_DEFAULT} ssl http2;

  server_name ${SUB_NTFY};

  ssl_certificate /etc/letsencrypt/live/${DOMAIN}/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/${DOMAIN}/privkey.pem;

  set $upstream_ntfy "ntfy:${NTFY_PORT}";

  resolver 127.0.0.11 valid=1m;

  location / {

    rewrite /(.*) /$1 break;
    proxy_pass http://$upstream_ntfy/$1$is_args$args;
    proxy_http_version 1.1;

    proxy_set_header Host $http_host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_connect_timeout 3m;
    proxy_send_timeout 3m;
    proxy_read_timeout 3m;

    client_max_body_size 0;
  }
}

What i really don't understand is why it stopped working. I should have read a hundred times all the configuration page from ntfy.sh without finding any problems in my configuration.
Since I didn't see any new post about that issue I assumed it was an nginx configuration issue, but every other services I host, and ntfy usage (webapp, android) are still working.
I upgrade recently IOS 17 to 18 without any improvement.

I'm running out of ideas, if anyone is facing the same issue, join the club ;)

I'd also like to take this opportunity to congratulate you on your great work!

@GuillaumeDebernard GuillaumeDebernard added the 🪲 bug Something isn't working label Sep 29, 2024
@a1ad
Copy link

a1ad commented Oct 8, 2024

Yeah, same here

@plittlefield
Copy link

I’ve just installed the docker ntfy behind a Traefik proxy with password user logins and a topic called with an API.

It all works but I’m not getting any iOS notifications - UNLESS I go in to the app and pull down to refresh.

What am I doing wrong or is this a deal breaking bug?!

Thanks.

@wunter8
Copy link
Contributor

wunter8 commented Oct 8, 2024

In general, notifications to iOS are tricky. I haven't heard anything specific about updates to iOS 18 or Nginx causing problems, though. It's definitely strange that things were working and then stopped (at least for OP).

You'll have better luck with notifications on iOS through the PWA. You'll need to set up web push keys on your self-hosted server (and have the server behind a domain with a TLS cert that is publicly trusted (e.g., not self-signed)), but it's easy to set up. With the PWA, notifications should arrive reliably, and you'll have more features than the native iOS app (like markdown formatting and embedded image previews).

Here's the list of things I tell people to do to get iOS notifications working, so you can double-check that everything is in order (but again, if it was working and stopped without any sort of config change, I don't know what would cause that):

  1. open a browser to the web app of your ntfy instance and copy the URL (including "http://" or "https://", your domain or IP address, and any ports, and excluding any trailing slashes)
  2. put the URL you copied in the ntfy base-url config in server.yml or NTFY_BASE_URL in env variables
  3. put the URL you copied in the default server URL setting in the iOS ntfy app
  4. set upstream-base-url in server.yml or NTFY_UPSTREAM_BASE_URL in env variables to "https://ntfy.sh"

@plittlefield
Copy link

Wow, very detailed reply many thanks.

I will try that tomorrow and report back.

@plittlefield
Copy link

Hi @wunter8 I have news.

The addition of the variable NTFY_UPSTREAM_BASE_URL to my docker-compose.yml now makes a Notification appear in the Notification Centre of my iPhone.

However, this is still not quite good enough for me, because I need it to appear on the Lock Screen ... just like Pushover does.

Also, what is PWA ?

@plittlefield
Copy link

OK, I take that back!

I have just received a ntfy notification on my lock screen and my watch!

Happy days!

@a1ad
Copy link

a1ad commented Oct 9, 2024

@plittlefield with the app from the store? Mine is still not working

@wunter8 can we use "server.yml" and the docker ENVs at the same time?

@plittlefield
Copy link

plittlefield commented Oct 9, 2024

@a1ad yes.

Here is my redacted docker compose file ...

https://pastebin.com/raw/TjEiyaZs

@wunter8
Copy link
Contributor

wunter8 commented Oct 9, 2024

@a1ad I think it's okay to use server.yml and env variables simultaneously, but I'm not certain which would take priority if there were conflicts. Probably the env variables. I'd recommend just using one or the other, though, to avoid complicating things

The PWA (Progressive Web App) allows you to install the web app as a standalone app on your phone. It can still receive notifications in the background (on iOS >= 16.4), has more features than the native app (like markdown support), and has more reliable notifications. To self host the PWA, you need to configure web push keys (https://docs.ntfy.sh/config#web-push)

@plittlefield
Copy link

OK, I might try that tomorrow.

What do I have to install on the phone for this work or does it just use the existing iOS app?

@wunter8
Copy link
Contributor

wunter8 commented Oct 9, 2024

After setting up the web push keys, load the self-hosted web app in Safari and then go to Share > "add to homescreen"

@plittlefield
Copy link

Blimey, I did not know about that and I've had an iPhone for 5 years :-)

@plittlefield
Copy link

Oooo, will that give me nice count badges?!

@wunter8
Copy link
Contributor

wunter8 commented Oct 9, 2024

Background notifications for PWAs on iOS have only been supported since iOS 16.4 (March 2023).

I'm not sure about the count badges 🤷‍♂️ (I don't use iOS)

@plittlefield
Copy link

image

@wunter8
Copy link
Contributor

wunter8 commented Oct 9, 2024

Oh, I know what they are. I just don't know if PWAs support it in general. And I don't know if the ntfy PWA supports them specifically.

(Or were you showing us the ntfy app doesn't have a badge meaning they're apparently not supported? I also can't tell if that's the ntfy app or the ntfy PWA)

@plittlefield
Copy link

A bit of both - showing you the unread badge count on WhatsApp and that ntfy does not support that feature yet.

@plittlefield
Copy link

Web push configured and seems to be OK but after putting the Safari bookmark on the iOS home screen (and then a login to my ntfy account) I no only do not get new notifications but also no unread badges.

Oh well.

I shall stick to the actual app for now.

@plittlefield
Copy link

I’m trying Chrome on iOS as well - it shows the notice about adding notifications -
IMG_1493

@wunter8
Copy link
Contributor

wunter8 commented Oct 10, 2024

When you click on the ntfy-web icon on your homescreen, does it just load the web app in Safari or does it launch a PWA in a standalone screen (without the Safari URL bar on top and stuff)?

@plittlefield
Copy link

I think it’s a PWA … what do you think?

IMG_1496

IMG_1497

… getting there, but of course it’s the actual iOS app that’s showing me notifications on my “Notification Centre” and not the web app.

At least I think so!

Did you want me to uninstall the actual App to see ?

@wunter8
Copy link
Contributor

wunter8 commented Oct 10, 2024

Yes, that looks like the PWA. You could try uninstalling the native app. No reason not to try that

@plittlefield
Copy link

Okay, that's uninstalled ... drum roll for later today :-)

@plittlefield
Copy link

Well blow me down with a feather!

IMG_1506

@svewag
Copy link

svewag commented Oct 27, 2024

I can confirm that the notifications on iOS are working just fine in the PWA, but not in the app.

@chlorine3545
Copy link

@wunter8 Sorry to interrupt. What is NTFY_UPSTREAM_BASE_URL? Do notifications from our self-hosted server need to be forwarded to the official ntfy server?

Also, if I may ask politely, is it because the official ntfy server has APNS configured, whereas our self-hosted server does not?

I'm a novice in this area, so apologies for any mistakes.

@wunter8
Copy link
Contributor

wunter8 commented Oct 31, 2024

@chlorine3545 You are correct. Here's some info: https://docs.ntfy.sh/config/#ios-instant-notifications

Let me know if you have more questions

@chlorine3545
Copy link

First of all, thanks for your reply @wunter8.

Not only Ntfy, but all these unified push can't work properly on iOS, we have to use APNs, which is a shame to some extent. Maybe I should get an Android phone and flash it with LineageOS or something.

@lbeier
Copy link

lbeier commented Nov 1, 2024

Hey folks! First of all, thanks for this amazing project! 🥇

I'm also having issues with iOS push notifications. I've set both base-url and upstream-base-url and I believe they are correct.

Not sure what else I'm missing though. It's likely be something really stupid, but I can't really understand what it is.

Here is my docker-compose.yml:

version: "2.1"
services:
  ntfy:
    image: binwiederhier/ntfy:latest
    container_name: ntfy
    command:
      - serve
    environment:
      - TZ=Europe/Madrid
    volumes:
      - lib:/var/lib/ntfy
      - config:/etc/ntfy
    ports:
      - 31209:80 # I have something else running on port 80, so I generated a random port for host
    restart: unless-stopped
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

volumes:
  lib: {}
  config: {}

And here is my server.yml:

base-url: "https://ntfy.<MY-HOMELAB-HOST>"
upstream-base-url: "https://ntfy.sh"

auth-file: "/var/lib/ntfy/auth.db"
auth-default-access: "deny-all"
enable-login: true

behind-proxy: true

cache-file: "/var/lib/ntfy/cache.db"

attachment-cache-dir: "/var/lib/ntfy/attachments"
attachment-total-size-limit: "5G"
attachment-file-size-limit: "15M"
attachment-expiry-duration: "3h"
visitor-attachment-total-size-limit: "100M"
visitor-attachment-daily-bandwidth-limit: "500M"

Some additional info that might be relevant:

  • If I open my NTFY server page in a browser in my laptop, I get instant notifications
  • My NTFY instance is behind a Nginx Proxy Manager, so the behind-proxy needs to be set to true as per my understanding.
  • On iOS NTFY app:
    • The default server is set to my https://ntfy.<MY-HOMELAB-HOST>" with https:// and no trailing /.
    • I've logged in with the admin user I created.
    • I can see the messages if I manually refresh the notifications page, the issue is only with push notifications
    • notifications are set to be delivered instantly
    • is allowed to run in background
  • I have network wide adblocking (Adguard Home), but I don't see anything being blocked by Adguard that is related to NTFY container.

@lbeier
Copy link

lbeier commented Nov 1, 2024

So, I've installed the NTFY app on my iPad and the notifications are working on the iPad.

Both iPhone and iPad are in public beta.

iOS 18.1 (22B83)
iPadOS 18.1 (22B82)

There was a pending update on my iPad. Just installed it (iPadOS 18.1 (22B83)) and the notifications are still working.

The issue seems to be isolated to iOS only. 🤔

@wunter8
Copy link
Contributor

wunter8 commented Nov 1, 2024

Hmm. I haven't heard of someone having issues on iOS but not on iPadOS. That seems to suggest your ntfy server is configured correctly. I've heard some people say reinstalling the ntfy app can help. But I'm not sure what else to try.

I generally recommend people use the PWA on iOS, though. It has more features than the native app and more reliable notifications. You need to configure web push to get it to work: https://docs.ntfy.sh/config#web-push

@lbeier
Copy link

lbeier commented Nov 1, 2024

Hey @wunter8!

Thanks for the suggestion! I've setup and I'm getting notifications on the pwa now.

Will still investigate a bit mor about the iOS specific issue and get back here if I find something. But for now, the pwa is working just fine.

@plittlefield
Copy link

I'd like to chime in and say that while the PWA is working great, there does not seem to be a synchronisation between the PWA app running on my phone and the web site in a browser tab.

What I mean by this is that when I get a notification it appears on both devices, BUT when I read or read and delete from either of the devices, the other device does not appear the same ... indeed all notifications remain UNREAD.

@wunter8
Copy link
Contributor

wunter8 commented Nov 1, 2024

@plittlefield That is the expected behavior right now. The state of individual messages is not synchronized between devices/clients

@plittlefield
Copy link

plittlefield commented Nov 1, 2024 via email

@soffio
Copy link

soffio commented Nov 3, 2024

I set up a self-hosted a few days ago and it worked fine. But yesterday I couldn't receive notifications anymore. Today I reinstalled the app and it worked again. It's so weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants