mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #1663] Firefox Web Push: unexpected response (response_code=401) #1161
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#1161
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 @moll on GitHub (Mar 18, 2026).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1663
Hey,
Thanks for making Ntfy open-source and maintaining it.
I'm seeing the Web Push notifications failing on Firefox and haven't managed to track down why it happens. Maybe you've seen the same or know where to look.
First, this is with Ntfy v2.17 on Linux 64-bit with Firefox v148 on a self-hosted instance. Created new web push keys, enabled web push in Ntfy, enabled push in the browser, subscribed to a notification channel, and confirmed that there was a subscription present in the webpush SQLite database. Triggered a notification from another device (the mobile app in this case) and saw its delivery to the web push fail the logs. After that, as expected, the subscription gets removed from the web push cache as Ntfy probably considers it invalid.
In the logs, slightly anonymized:
DEBUG Unable to publish web push message, unexpected response (message_body_size=125, message_event=message, message_id=ID123, message_sender=1.2.3.4, message_sequence_id=ID123, message_time=1773832676, message_user=u_ATXX, response_code=401, tag=webpush, ..., web_push_subscription_endpoint=https://updates.push.services.mozilla.com/wpush/v2/gAAAAAXXX, web_push_subscription_id=wps_XXX, ...The trace log level doesn't log the response body either, so I'm not exactly sure what Mozilla's push service responds with the 401 response code.
After that line there's another warning line, but I presume that's just the debug message bubbling up and causing a 500 in Ntfy:
WARN Unable to publish web push message (error=internal server error: unable to publish web push message, error_code=50004, http_status=500, message_body_size=125, message_event=message, ...)I tested it on the hosted instance (https://ntfy.sh) a few minutes ago and there things seem to work. Unless it was something you fixed in the recent versions, though the release notes don't mention anything related to web push.
Checking
about:serviceworkerson Firefox seems to nicely show the service worker for both my instance and ntfy.sh. One thing that's different from the hosted variant is that I'm running my instance on a non-standard HTTPS port. Without visibility or knowledge on how web push works, could that be the cause of some errors sending the push to Mozilla's service? I am using a WebPKI cert, so self-signed certs aren't involved either.Thanks in advance!
@nihalgonsalves commented on GitHub (Mar 22, 2026):
I would regenerate the web push keys and double-check whether your origin is set correctly. My first guess would be that the origin doesn't match. For example if you rewrite the origin via a reverse proxy, it won't work.
For web push to work, your ntfy
base-urland the origin of the site that requests the web push keys have to match. (The origin is basicallyhttps://ntfy.example.com- protocol, hostname including domain/subdomain, and port number - 443 implied here).@Karotte128 commented on GitHub (Mar 30, 2026):
Same issue on my instance. Tested on Chrome + Safari. The base-url is correct. I tried regenerating the keys a few times, did not help.