[GH-ISSUE #1251] Ntfy sub not working with servers behind cloudflare. #883

Closed
opened 2026-05-07 00:28:27 +02:00 by BreizhHardware · 5 comments

Originally created by @tpkowastaken on GitHub (Jan 5, 2025).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1251

🐞 Describe the bug

Whenever running ntfy sub https://my-own-ntfy-server.com/TOPIC the command stays idle and doesn't listen to any messages coming to this topic when the servers are routed through cloudflare tunnels. It gives a 524 after a while.

tom@toms-MacBook-Pro ~ % ntfy sub https://my-own-ntfy-server.com/JIDLO
2025/01/06 01:12:27 WARN my-own-ntfy-server.com/JIDLO Connection failed: error code: 524

💻 Components impacted

  • ntfy cli

💡 Screenshots and/or logs

curl to the server
tom@toms-MacBook-Pro ~ % curl https://my-own-ntfy-server.com/JIDLO
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>ntfy web</title>

    <!-- Mobile view -->
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="HandheldFriendly" content="true" />

    <!-- Mobile browsers, background color -->
    <meta name="theme-color" content="#317f6f" />
    <meta name="msapplication-navbutton-color" content="#317f6f" />
    <meta name="apple-mobile-web-app-status-bar-style" content="#317f6f" />
    <link rel="apple-touch-icon" href="/static/images/apple-touch-icon.png" sizes="180x180" />
    <link rel="mask-icon" href="/static/images/mask-icon.svg" color="#317f6f" />

    <!-- Favicon, see favicon.io -->
    <link rel="icon" type="image/png" href="/static/images/favicon.ico" />

    <!-- Previews in Google, Slack, WhatsApp, etc. -->
    <meta
      name="description"
      content="ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy."
    />
    <meta property="og:type" content="website" />
    <meta property="og:locale" content="en_US" />
    <meta property="og:site_name" content="ntfy web" />
    <meta property="og:title" content="ntfy web" />
    <meta
      property="og:description"
      content="ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy."
    />
    <meta property="og:image" content="/static/images/ntfy.png" />
    <meta property="og:url" content="https://ntfy.sh" />

    <!-- Never index -->
    <meta name="robots" content="noindex, nofollow" />

    <!-- Style overrides & fonts -->
    <link rel="stylesheet" href="/static/css/app.css" type="text/css" />
    <link rel="stylesheet" href="/static/css/fonts.css" type="text/css" />

    <!-- PWA -->
    <link rel="manifest" href="/manifest.webmanifest" />
    <script type="module" crossorigin src="/static/media/index-9e24212a.js"></script>
  </head>
  <body>
    <noscript>
      ntfy web requires JavaScript, but you can also use the
      <a href="https://ntfy.sh/docs/subscribe/cli/">CLI</a> or <a href="https://ntfy.sh/docs/subscribe/phone/">Android/iOS app</a> to
      subscribe.
    </noscript>
    <div id="root"></div>
    <script src="/config.js"></script>

  </body>
</html>
listening to websockets using wscat
wscat -c "wss://my-own-ntfy-server.com/JIDLO/ws"
Connected (press CTRL+C to quit)
< {"id":"8vkXwNdH0FS7","time":1736148218,"event":"open","topic":"JIDLO"}

< {"id":"SJpq3axiPrJv","time":1736148221,"expires":1736191421,"event":"message","topic":"JIDLO","message":"JIDLO","priority":3}

🔮 Additional context

The server that is hosting ntfy is behind cloudflare tunnels because of my limited network. Cloudflare tunnels enforce using https therefore using http is not an option. Cloudflare supports wss as shown

Also the server and command is completely fine when connecting through my local network:

ntfy sub http://192.168.100.128/JIDLO
{"id":"IxsiF9K1CguP","time":1736120908,"expires":1736164108,"event":"message","topic":"JIDLO","message":"JIDLO","priority":3}

Curl looks the same on both

curl to the local server

curl http://192.168.100.128/JIDLO
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>ntfy web</title>

    <!-- Mobile view -->
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="HandheldFriendly" content="true" />

    <!-- Mobile browsers, background color -->
    <meta name="theme-color" content="#317f6f" />
    <meta name="msapplication-navbutton-color" content="#317f6f" />
    <meta name="apple-mobile-web-app-status-bar-style" content="#317f6f" />
    <link rel="apple-touch-icon" href="/static/images/apple-touch-icon.png" sizes="180x180" />
    <link rel="mask-icon" href="/static/images/mask-icon.svg" color="#317f6f" />

    <!-- Favicon, see favicon.io -->
    <link rel="icon" type="image/png" href="/static/images/favicon.ico" />

    <!-- Previews in Google, Slack, WhatsApp, etc. -->
    <meta
      name="description"
      content="ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy."
    />
    <meta property="og:type" content="website" />
    <meta property="og:locale" content="en_US" />
    <meta property="og:site_name" content="ntfy web" />
    <meta property="og:title" content="ntfy web" />
    <meta
      property="og:description"
      content="ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy."
    />
    <meta property="og:image" content="/static/images/ntfy.png" />
    <meta property="og:url" content="https://ntfy.sh" />

    <!-- Never index -->
    <meta name="robots" content="noindex, nofollow" />

    <!-- Style overrides & fonts -->
    <link rel="stylesheet" href="/static/css/app.css" type="text/css" />
    <link rel="stylesheet" href="/static/css/fonts.css" type="text/css" />

    <!-- PWA -->
    <link rel="manifest" href="/manifest.webmanifest" />
    <script type="module" crossorigin src="/static/media/index-9e24212a.js"></script>
  </head>
  <body>
    <noscript>
      ntfy web requires JavaScript, but you can also use the
      <a href="https://ntfy.sh/docs/subscribe/cli/">CLI</a> or <a href="https://ntfy.sh/docs/subscribe/phone/">Android/iOS app</a> to
      subscribe.
    </noscript>
    <div id="root"></div>
    <script src="/config.js"></script>

  </body>
</html>

Originally created by @tpkowastaken on GitHub (Jan 5, 2025). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1251 :lady_beetle: **Describe the bug** Whenever running `ntfy sub https://my-own-ntfy-server.com/TOPIC` the command stays idle and doesn't listen to any messages coming to this topic when the servers are routed through cloudflare tunnels. It gives a 524 after a while. ``` tom@toms-MacBook-Pro ~ % ntfy sub https://my-own-ntfy-server.com/JIDLO 2025/01/06 01:12:27 WARN my-own-ntfy-server.com/JIDLO Connection failed: error code: 524 ``` :computer: **Components impacted** * ntfy cli :bulb: **Screenshots and/or logs** <details> <summary> curl to the server </summary> ``` tom@toms-MacBook-Pro ~ % curl https://my-own-ntfy-server.com/JIDLO <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>ntfy web</title> <!-- Mobile view --> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="HandheldFriendly" content="true" /> <!-- Mobile browsers, background color --> <meta name="theme-color" content="#317f6f" /> <meta name="msapplication-navbutton-color" content="#317f6f" /> <meta name="apple-mobile-web-app-status-bar-style" content="#317f6f" /> <link rel="apple-touch-icon" href="/static/images/apple-touch-icon.png" sizes="180x180" /> <link rel="mask-icon" href="/static/images/mask-icon.svg" color="#317f6f" /> <!-- Favicon, see favicon.io --> <link rel="icon" type="image/png" href="/static/images/favicon.ico" /> <!-- Previews in Google, Slack, WhatsApp, etc. --> <meta name="description" content="ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy." /> <meta property="og:type" content="website" /> <meta property="og:locale" content="en_US" /> <meta property="og:site_name" content="ntfy web" /> <meta property="og:title" content="ntfy web" /> <meta property="og:description" content="ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy." /> <meta property="og:image" content="/static/images/ntfy.png" /> <meta property="og:url" content="https://ntfy.sh" /> <!-- Never index --> <meta name="robots" content="noindex, nofollow" /> <!-- Style overrides & fonts --> <link rel="stylesheet" href="/static/css/app.css" type="text/css" /> <link rel="stylesheet" href="/static/css/fonts.css" type="text/css" /> <!-- PWA --> <link rel="manifest" href="/manifest.webmanifest" /> <script type="module" crossorigin src="/static/media/index-9e24212a.js"></script> </head> <body> <noscript> ntfy web requires JavaScript, but you can also use the <a href="https://ntfy.sh/docs/subscribe/cli/">CLI</a> or <a href="https://ntfy.sh/docs/subscribe/phone/">Android/iOS app</a> to subscribe. </noscript> <div id="root"></div> <script src="/config.js"></script> </body> </html> ``` </details> <details> <summary>listening to websockets using wscat</summary> ``` wscat -c "wss://my-own-ntfy-server.com/JIDLO/ws" Connected (press CTRL+C to quit) < {"id":"8vkXwNdH0FS7","time":1736148218,"event":"open","topic":"JIDLO"} < {"id":"SJpq3axiPrJv","time":1736148221,"expires":1736191421,"event":"message","topic":"JIDLO","message":"JIDLO","priority":3} ``` </details> :crystal_ball: **Additional context** <!-- Add any other context about the problem here. --> The server that is hosting ntfy is behind cloudflare tunnels because of my limited network. Cloudflare tunnels enforce using https therefore using http is not an option. Cloudflare supports wss as shown Also the server and command is completely fine when connecting through my local network: ``` ntfy sub http://192.168.100.128/JIDLO {"id":"IxsiF9K1CguP","time":1736120908,"expires":1736164108,"event":"message","topic":"JIDLO","message":"JIDLO","priority":3} ``` Curl looks the same on both <details> <summary> curl to the local server </summary> ``` curl http://192.168.100.128/JIDLO <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>ntfy web</title> <!-- Mobile view --> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="HandheldFriendly" content="true" /> <!-- Mobile browsers, background color --> <meta name="theme-color" content="#317f6f" /> <meta name="msapplication-navbutton-color" content="#317f6f" /> <meta name="apple-mobile-web-app-status-bar-style" content="#317f6f" /> <link rel="apple-touch-icon" href="/static/images/apple-touch-icon.png" sizes="180x180" /> <link rel="mask-icon" href="/static/images/mask-icon.svg" color="#317f6f" /> <!-- Favicon, see favicon.io --> <link rel="icon" type="image/png" href="/static/images/favicon.ico" /> <!-- Previews in Google, Slack, WhatsApp, etc. --> <meta name="description" content="ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy." /> <meta property="og:type" content="website" /> <meta property="og:locale" content="en_US" /> <meta property="og:site_name" content="ntfy web" /> <meta property="og:title" content="ntfy web" /> <meta property="og:description" content="ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy." /> <meta property="og:image" content="/static/images/ntfy.png" /> <meta property="og:url" content="https://ntfy.sh" /> <!-- Never index --> <meta name="robots" content="noindex, nofollow" /> <!-- Style overrides & fonts --> <link rel="stylesheet" href="/static/css/app.css" type="text/css" /> <link rel="stylesheet" href="/static/css/fonts.css" type="text/css" /> <!-- PWA --> <link rel="manifest" href="/manifest.webmanifest" /> <script type="module" crossorigin src="/static/media/index-9e24212a.js"></script> </head> <body> <noscript> ntfy web requires JavaScript, but you can also use the <a href="https://ntfy.sh/docs/subscribe/cli/">CLI</a> or <a href="https://ntfy.sh/docs/subscribe/phone/">Android/iOS app</a> to subscribe. </noscript> <div id="root"></div> <script src="/config.js"></script> </body> </html> ``` </summary>
BreizhHardware 2026-05-07 00:28:27 +02:00
  • closed this issue
  • added the
    🪲 bug
    label
Author
Owner

@TheRedScreen64 commented on GitHub (Jan 27, 2025):

I'm having the same issue

<!-- gh-comment-id:2615536212 --> @TheRedScreen64 commented on GitHub (Jan 27, 2025): I'm having the same issue
Author
Owner

@DanielOberlechner commented on GitHub (Jan 27, 2025):

I solved the issue with cloudflare my instance is now working.
Gotta check at home how I have configured it and will then post it here. Maybe a youtube video would also help ...

Networkchuck has a good tutorial on Youtube with NTFY which helped me quite further maybe it helps you people as well...

<!-- gh-comment-id:2615895015 --> @DanielOberlechner commented on GitHub (Jan 27, 2025): I solved the issue with cloudflare my instance is now working. Gotta check at home how I have configured it and will then post it here. Maybe a youtube video would also help ... Networkchuck has a good tutorial on Youtube with NTFY which helped me quite further maybe it helps you people as well...
Author
Owner

@mvnixon commented on GitHub (Feb 22, 2025):

What solved this issue?

<!-- gh-comment-id:2676081106 --> @mvnixon commented on GitHub (Feb 22, 2025): What solved this issue?
Author
Owner

@DanielOberlechner commented on GitHub (Feb 22, 2025):

@mvnixon I simply went almost completely by this video:
https://www.youtube.com/watch?v=poDIT2ruQ9M

If this won't work for you tell me once again and I will show in a quick youtube video my setup how I've it done....

I simply got it working by going by this video. The cloudflare ui on the website has changed (the video is 1 year old) but in the common ground it stays the same ...

<!-- gh-comment-id:2676167286 --> @DanielOberlechner commented on GitHub (Feb 22, 2025): @mvnixon I simply went almost completely by this video: https://www.youtube.com/watch?v=poDIT2ruQ9M If this won't work for you tell me once again and I will show in a quick youtube video my setup how I've it done.... I simply got it working by going by this video. The cloudflare ui on the website has changed (the video is 1 year old) but in the common ground it stays the same ...
Author
Owner

@binwiederhier commented on GitHub (Jan 18, 2026):

This is not an issue with ntfy, but rather with your setup. We are always happy to provide support on Discord/Matrix.

<!-- gh-comment-id:3765469444 --> @binwiederhier commented on GitHub (Jan 18, 2026): This is not an issue with ntfy, but rather with your setup. We are always happy to provide support on Discord/Matrix.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#883
No description provided.