mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 16:35:53 +02:00
[GH-ISSUE #1275] Ntfy on Android: can't connect to Ntfy server (on wifi) behind VPN when restricted to wifi only #900
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#900
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 @GideonBear on GitHub (Feb 6, 2025).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1275
🐞 Describe the bug
When I set Ntfy to "wifi only" in my settings (Samsung), it fails to connect to my Ntfy server over a WireGuard VPN, even on wifi (mobile data is off). When "Mobile data or wifi" is selected, it connects fine.
💻 Components impacted
Android app
💡 Screenshots and/or logs
https://nopaste.net/9iBLnfgCnN
🔮 Additional context
When "wifi only" is selected, I do get notifications over mobile data. Attachments fail to download.
This is probably related, and also an issue for me; I want to use as little mobile data as possible.
@Ravindranathrl commented on GitHub (Feb 25, 2025):
I've investigated this issue and found that it likely stems from how the WireGuard VPN routes traffic when restricted to "Wi-Fi only." The error logs indicate a java.net.ConnectException: Failed to connect to /172.17.0.1:1420, which suggests that the app is trying to connect to a local IP that may not be accessible over the VPN when only Wi-Fi is enabled.
Add the following to your WireGuard configuration to ensure all traffic, including Wi-Fi-only traffic, routes through the VPN:
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25
Use a Public IP Address Instead of a Local IP:
Replace 172.17.0.1 with the public IP address or domain of your Ntfy server. This ensures that traffic is routed correctly through the VPN tunnel, even on Wi-Fi.
Adjust Android VPN Settings:
Set the VPN to Always-on VPN and enable Block connections without VPN in Android settings.
Disable Mobile Data Always Active in Developer Options (if available) to force the device to rely entirely on Wi-Fi.
Check App Permissions:
Ensure that the app has these permissions in the Android manifest: