OutboundPolicy for notifications is hard-coded to `OutboundPolicy::PublicOnly`

Issue Description

I’m running Stalwart on a server on an internal network with several other services accessible using split DNS, including ntfy, for push notifications.

Stalwart allows registrations but doesn’t send any notifications. As best I can tell, this is because the HTTP client used to send them is hard-coded to OutboundPolicy::PublicOnly, which results in internal IP addresses being discarded, which is problematic because my notification server has an internal IP address.

To confirm, I ran the server with the following patch applied. When I did, push notifications worked correctly.

diff --git a/crates/jmap/src/push/set.rs b/crates/jmap/src/push/set.rs
index c8e7484c..574052c4 100644
--- a/crates/jmap/src/push/set.rs
+++ b/crates/jmap/src/push/set.rs
@@ -425,7 +425,7 @@ fn validate_push_value(
 }

 fn validate_push_url(url: &str) -> Result<(), OutboundError> {
-    OutboundPolicy::PublicOnly.parse_url(url).map(|_| ())
+    OutboundPolicy::Trusted.parse_url(url).map(|_| ())
 }

 fn parse_email_push(
diff --git a/crates/services/src/state_manager/http.rs b/crates/services/src/state_manager/http.rs
index bb9f5242..1b825932 100644
--- a/crates/services/src/state_manager/http.rs
+++ b/crates/services/src/state_manager/http.rs
@@ -259,7 +259,7 @@ async fn post_object(
 pub(crate) fn build_push_client() -> OutboundClient {
     OutboundClient::new(
         utils::http::http_client_builder(cfg!(stalwart_tests)),
-        OutboundPolicy::PublicOnly,
+        OutboundPolicy::Trusted,
         Redirects::SameOrganization(MAX_REDIRECTS),
     )
 }

Expected Behavior

OutboundPolicy::PublicOnly is configurable. When not used, notifications to an internal IP succeed.

Actual Behavior

OutboundPolicy is not configurable. Notifications to an internal IP are blocked.

Reproduction Steps

  1. Set up ntfy on an internal server with split DNS.
  2. Register a client for notifications using ntfy
  3. Trigger something that results in a notification.

Relevant Log Output

2026-10-30T20:55:46Z DEBUG Push subscription error (push-subscription.error) details = "HTTP POST failed", url = "<url>", reason = "error sending request for url (<url>)"

Stalwart Version

v1.x

Installation Method

Docker

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

Your reading is correct, and it’s documented behaviour. I found no setting that changes it.

Stalwart accepts a push subscription only for a public https URL. A URL is refused if it uses another scheme, contains credentials, or has a host that is private, loopback or otherwise non-public. The docs say the same check is applied again when notifications are sent. So a name that resolves to an internal address through split DNS won’t receive notifications, even if the subscription was accepted. This matches what your patch shows: the restriction is applied at both validation and send time, and neither place has a configuration option.

Until the policy becomes configurable, there are two workarounds I can see in the docs:

  • Expose ntfy on a public address with https.
  • Keep running your patched build.

I found no documented setting for allowing internal destinations. Making the policy configurable would be a feature request, and a human will follow up here.

Docs: Push notifications | Stalwart

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Regarding the documented behaviour:

A URL with another scheme, a URL with credentials, and a URL whose host is a private, loopback or otherwise non-public address or name are refused with invalidProperties on url, with a description such as URL must use the https scheme or Destination is a local or reserved IP address.

This does not seem to be the case. At no point do I see an error like this, I only see “HTTP POST failed”.

Hi Jim,

PublicOnly on push is deliberate. The URL of a push subscription comes from the client, so without it any account on the server could point Stalwart at an internal service and have it POST there. It isn’t configurable in 1.0, for administrators either.

The docs and your log fit together once you separate the two checks. When a subscription is created, Stalwart only looks at the URL text and does no DNS lookup. An IP literal or a name under a non-public suffix gets the invalidProperties error, but your ntfy hostname sits under a public suffix, so it’s accepted. The internal address only shows up when a notification is sent: the resolver drops every non-public address, the request fails, and you get HTTP POST failed. That’s the last sentence of the paragraph you quoted, “a name that later resolves to a private address does not receive them”.

If ntfy also has a public address, you can leave the code alone: a single public address in the DNS answer is enough, so giving the Stalwart container a resolver outside your split DNS (the dns option in Docker) will send notifications out that way.

Your patch does work. Trusted turns off all of these checks for every subscription on the server, though, including the https requirement, so I’d only run it where you trust everyone who has an account.

An admin setting or allow-list for internal push targets would be a new feature, so please open a topic for it in Feature Ideas (Feature Ideas - Stalwart Support) with your setup.

One follow-up on the second half of your report, Jim. That bare error sending request for url was a gap on our side: the log kept the outer error from the HTTP client and dropped the cause underneath it, so the refusal never showed up. The push error now logs the whole chain, so a blocked address will read Destination is a local or reserved IP address in the reason. The same goes for the other outbound HTTP errors. The fix ships in the next weekly release. It only changes the log; the policy on internal addresses stays as I described above.

I also have the same problem and would benefit from an admin setting. Self-hosting the push distributor on the same machine or LAN as the mail server seems like a common layout. A setting to trust specific hosts or networks for push subscription URLs (off by default) would solve it without weakening the protection for everyone else.