[GH-ISSUE #723] Download url for attachment doesn't include port number #530

Closed
opened 2026-05-07 00:25:08 +02:00 by BreizhHardware · 4 comments

Originally created by @lsaranto on GitHub (May 13, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/723

🐞 Describe the bug
I'm running Ntfy with custom ports (44480 & 44443). The attachments' download URL doesn't include correct port number. This makes the attachments not downloadable. If I copy the download URL and add port number (44480) then it of course works. Although, I'd prefer to use https and port 44443 for attachments so I don't have to port forward both ports.

💻 Components impacted
ntfy server, Android app, web app

💡 Screenshots and/or logs
This is a log of the ntfy Android app. The log shows up to 1,000 entries.

Device info:

ntfy: 1.16.0 (fdroid)
OS: 4.19.113-26205065
Android: 13 (SDK 33)
Model: r8q
Product: r8qxeea

--
Settings:
{
"autoDeleteSeconds": 2592000,
"autoDownloadMaxSize": 1048576,
"broadcastEnabled": true,
"connectionProtocol": "ws",
"darkMode": 2,
"defaultBaseUrl": "https://www.example.com:44443",
"lastSharedTopics": [],
"minPriority": 1,
"mutedUntil": 0,
"recordLogs": true
}

Logs

1683969558851 2023-05-13 12:19:18.851 D NtfyLog Enabled log recording
1683969631999 2023-05-13 12:20:31.999 D NtfyWsConnection www.example.com:44443/sarantola,homelab (gid=1, lid=1): Received message: {"id":"1zEd3dzsUuux","time":1683969631,"expires":1684012831,"event":"message","topic":"homelab","title":"Test notification","message":"Hello world!","attachment":{"name":"2009-10-08 19-27-46.jpg","type":"image/jpeg","size":1082053,"expires":1687281631,"url":"http://www.example.com/file/1zEd3dzsUuux.jpg"}}

1683969632004 2023-05-13 12:20:32.004 D NtfySubscriberService [https://www.example.com:44443/homelab] Received notification: Notification(id=1zEd3dzsUuux, subscriptionId=83328794, timestamp=1683969631, title=Test notification, message=Hello world!, encoding=, notificationId=1618584510, priority=3, tags=, click=, icon=null, actions=null, attachment=Attachment(name=2009-10-08 19-27-46.jpg, type=image/jpeg, size=1082053, expires=1687281631, url=http://www.example.com/file/1zEd3dzsUuux.jpg, contentUri=null, progress=-1), deleted=false)
1683969632009 2023-05-13 12:20:32.009 D NtfySubscriberService [https://www.example.com:44443/homelab] Dispatching notification Notification(id=1zEd3dzsUuux, subscriptionId=83328794, timestamp=1683969631, title=Test notification, message=Hello world!, encoding=, notificationId=1618584510, priority=3, tags=, click=, icon=null, actions=null, attachment=Attachment(name=2009-10-08 19-27-46.jpg, type=image/jpeg, size=1082053, expires=1687281631, url=http://www.example.com/file/1zEd3dzsUuux.jpg, contentUri=null, progress=-1), deleted=false)
1683969632009 2023-05-13 12:20:32.009 D NtfyNotifDispatch Dispatching Notification(id=1zEd3dzsUuux, subscriptionId=83328794, timestamp=1683969631, title=Test notification, message=Hello world!, encoding=, notificationId=1618584510, priority=3, tags=, click=, icon=null, actions=null, attachment=Attachment(name=2009-10-08 19-27-46.jpg, type=image/jpeg, size=1082053, expires=1687281631, url=http://www.example.com/file/1zEd3dzsUuux.jpg, contentUri=null, progress=-1), deleted=false) for subscription Subscription(id=83328794, baseUrl=https://www.example.com:44443, topic=homelab, instant=true, mutedUntil=0, minPriority=0, autoDelete=-1, insistent=-1, lastNotificationId=CiVhBXzX1Kvv, icon=null, upAppId=null, upConnectorToken=null, displayName=null, dedicatedChannels=false, totalCount=1, newCount=0, lastActive=1683968677, state=CONNECTED)
1683969632010 2023-05-13 12:20:32.010 D NtfyNotifService Displaying notification Notification(id=1zEd3dzsUuux, subscriptionId=83328794, timestamp=1683969631, title=Test notification, message=Hello world!, encoding=, notificationId=1618584510, priority=3, tags=, click=, icon=null, actions=null, attachment=Attachment(name=2009-10-08 19-27-46.jpg, type=image/jpeg, size=1082053, expires=1687281631, url=http://www.example.com/file/1zEd3dzsUuux.jpg, contentUri=null, progress=-1), deleted=false)
1683969632036 2023-05-13 12:20:32.036 D NtfyBroadcastService Sending message intent broadcast: io.heckel.ntfy.MESSAGE_RECEIVED with extras Bundle[{base_url=https://www.example.com:44443, message_bytes=[72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33], message_encoding=, priority=3, tags_map=, attachment_name=2009-10-08 19-27-46.jpg, attachment_size=1082053, attachment_type=image/jpeg, attachment_expires=1687281631, id=1zEd3dzsUuux, tags=, time=1683969631, click=, muted=false, title=Test notification, topic=homelab, attachment_url=http://www.example.com/file/1zEd3dzsUuux.jpg, message=Hello world!, muted_str=false}]

🔮 Additional context

Originally created by @lsaranto on GitHub (May 13, 2023). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/723 :lady_beetle: **Describe the bug** I'm running Ntfy with custom ports (44480 & 44443). The attachments' download URL doesn't include correct port number. This makes the attachments not downloadable. If I copy the download URL and add port number (44480) then it of course works. Although, I'd prefer to use https and port 44443 for attachments so I don't have to port forward both ports. :computer: **Components impacted** ntfy server, Android app, web app :bulb: **Screenshots and/or logs** This is a log of the ntfy Android app. The log shows up to 1,000 entries. Device info: -- ntfy: 1.16.0 (fdroid) OS: 4.19.113-26205065 Android: 13 (SDK 33) Model: r8q Product: r8qxeea -- Settings: { "autoDeleteSeconds": 2592000, "autoDownloadMaxSize": 1048576, "broadcastEnabled": true, "connectionProtocol": "ws", "darkMode": 2, "defaultBaseUrl": "https://www.example.com:44443", "lastSharedTopics": [], "minPriority": 1, "mutedUntil": 0, "recordLogs": true } Logs -- 1683969558851 2023-05-13 12:19:18.851 D NtfyLog Enabled log recording 1683969631999 2023-05-13 12:20:31.999 D NtfyWsConnection www.example.com:44443/sarantola,homelab (gid=1, lid=1): Received message: {"id":"1zEd3dzsUuux","time":1683969631,"expires":1684012831,"event":"message","topic":"homelab","title":"Test notification","message":"Hello world!","attachment":{"name":"2009-10-08 19-27-46.jpg","type":"image/jpeg","size":1082053,"expires":1687281631,"url":"http://www.example.com/file/1zEd3dzsUuux.jpg"}} 1683969632004 2023-05-13 12:20:32.004 D NtfySubscriberService [https://www.example.com:44443/homelab] Received notification: Notification(id=1zEd3dzsUuux, subscriptionId=83328794, timestamp=1683969631, title=Test notification, message=Hello world!, encoding=, notificationId=1618584510, priority=3, tags=, click=, icon=null, actions=null, attachment=Attachment(name=2009-10-08 19-27-46.jpg, type=image/jpeg, size=1082053, expires=1687281631, url=http://www.example.com/file/1zEd3dzsUuux.jpg, contentUri=null, progress=-1), deleted=false) 1683969632009 2023-05-13 12:20:32.009 D NtfySubscriberService [https://www.example.com:44443/homelab] Dispatching notification Notification(id=1zEd3dzsUuux, subscriptionId=83328794, timestamp=1683969631, title=Test notification, message=Hello world!, encoding=, notificationId=1618584510, priority=3, tags=, click=, icon=null, actions=null, attachment=Attachment(name=2009-10-08 19-27-46.jpg, type=image/jpeg, size=1082053, expires=1687281631, url=http://www.example.com/file/1zEd3dzsUuux.jpg, contentUri=null, progress=-1), deleted=false) 1683969632009 2023-05-13 12:20:32.009 D NtfyNotifDispatch Dispatching Notification(id=1zEd3dzsUuux, subscriptionId=83328794, timestamp=1683969631, title=Test notification, message=Hello world!, encoding=, notificationId=1618584510, priority=3, tags=, click=, icon=null, actions=null, attachment=Attachment(name=2009-10-08 19-27-46.jpg, type=image/jpeg, size=1082053, expires=1687281631, url=http://www.example.com/file/1zEd3dzsUuux.jpg, contentUri=null, progress=-1), deleted=false) for subscription Subscription(id=83328794, baseUrl=https://www.example.com:44443, topic=homelab, instant=true, mutedUntil=0, minPriority=0, autoDelete=-1, insistent=-1, lastNotificationId=CiVhBXzX1Kvv, icon=null, upAppId=null, upConnectorToken=null, displayName=null, dedicatedChannels=false, totalCount=1, newCount=0, lastActive=1683968677, state=CONNECTED) 1683969632010 2023-05-13 12:20:32.010 D NtfyNotifService Displaying notification Notification(id=1zEd3dzsUuux, subscriptionId=83328794, timestamp=1683969631, title=Test notification, message=Hello world!, encoding=, notificationId=1618584510, priority=3, tags=, click=, icon=null, actions=null, attachment=Attachment(name=2009-10-08 19-27-46.jpg, type=image/jpeg, size=1082053, expires=1687281631, url=http://www.example.com/file/1zEd3dzsUuux.jpg, contentUri=null, progress=-1), deleted=false) 1683969632036 2023-05-13 12:20:32.036 D NtfyBroadcastService Sending message intent broadcast: io.heckel.ntfy.MESSAGE_RECEIVED with extras Bundle[{base_url=https://www.example.com:44443, message_bytes=[72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33], message_encoding=, priority=3, tags_map=, attachment_name=2009-10-08 19-27-46.jpg, attachment_size=1082053, attachment_type=image/jpeg, attachment_expires=1687281631, id=1zEd3dzsUuux, tags=, time=1683969631, click=, muted=false, title=Test notification, topic=homelab, attachment_url=http://www.example.com/file/1zEd3dzsUuux.jpg, message=Hello world!, muted_str=false}] :crystal_ball: **Additional context** <!-- Add any other context about the problem here. -->
BreizhHardware 2026-05-07 00:25:08 +02:00
  • closed this issue
  • added the
    🪲 bug
    label
Author
Owner

@wunter8 commented on GitHub (May 13, 2023):

Did you make sure that the base-url setting in your server.yml includes the port?

<!-- gh-comment-id:1546646020 --> @wunter8 commented on GitHub (May 13, 2023): Did you make sure that the base-url setting in your server.yml includes the port?
Author
Owner

@lsaranto commented on GitHub (May 13, 2023):

@wunter8 Thanks for the reply. I did not have the port number included in the base-url setting. After adding it and changing it to https gives me the URL I want. However, I'd argue that it's a bit repetitive, that the port is set in both the base-url and the listen-http(s) settings. But at least it is working ok.

<!-- gh-comment-id:1546669840 --> @lsaranto commented on GitHub (May 13, 2023): @wunter8 Thanks for the reply. I did not have the port number included in the base-url setting. After adding it and changing it to https gives me the URL I want. However, I'd argue that it's a bit repetitive, that the port is set in both the base-url and the listen-http(s) settings. But at least it is working ok.
Author
Owner

@wunter8 commented on GitHub (May 13, 2023):

One reason we need both settings is for use behind a reverse proxy, which is how most people self-host ntfy. For example, on my instance, the base url is https://ntfy.domain.com (without a port), and I have listen-http: ”:8010”. Then my reverse proxy redirects requests at ntfy.domain.com to localhost:8010

<!-- gh-comment-id:1546671651 --> @wunter8 commented on GitHub (May 13, 2023): One reason we need both settings is for use behind a reverse proxy, which is how most people self-host ntfy. For example, on my instance, the base url is `https://ntfy.domain.com` (without a port), and I have `listen-http: ”:8010”`. Then my reverse proxy redirects requests at ntfy.domain.com to localhost:8010
Author
Owner

@lsaranto commented on GitHub (May 13, 2023):

@wunter8 I almost added a question how can u even have a situation where those settings would not match. :) But yeah that is one such case. Me being a noob, I have not been able to set up a reverse proxy. But that is a question for another forum.

As a closing note: It might be beneficial to mention the need for the port number in the base-url setting description.

<!-- gh-comment-id:1546689480 --> @lsaranto commented on GitHub (May 13, 2023): @wunter8 I almost added a question how can u even have a situation where those settings would not match. :) But yeah that is one such case. Me being a noob, I have not been able to set up a reverse proxy. But that is a question for another forum. As a closing note: It might be beneficial to mention the need for the port number in the base-url setting description.
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#530
No description provided.