mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #398] Matrix gateway fails when mapping ntfy to subpath/subdirectory on a reverse proxy #304
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#304
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 @samr7 on GitHub (Sep 11, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/398
I tried mapping ntfy to a subpath on my reverse proxy.
I set
base-url: https://server.domain.com/ntfyI had to configure the reverse proxy to remove the
/ntfypath prefix when forwarding requests to the ntfy server.With these two steps, it mostly works. I can send notifications from the command line, and they are received on my Android phone.
I originally had a trailing slash on the base-url, and that broke UP registration. Removing the slash fixed things.
I also mapped
https://server.domain.com/_matrix/push/v1/notifyto the ntfy server.The bug is that the Matrix gateway fails in this configuration. Here's a snip from the trace log:
The topic most certainly is not ntfy, but it's pulling that out of the pushkey.
Should it be cutting the base-url from the beginning of the pushkey before looking for a topic?
This issue is similar to #256, but relates to the backend, not the web UI.
@binwiederhier commented on GitHub (Sep 11, 2022):
Running ntfy on a sub path is not supported. There have been attempts to make it work but it proved tricky or hacky. So as of today you need a subdomain.
@binwiederhier commented on GitHub (Oct 2, 2022):
Related https://github.com/binwiederhier/ntfy/issues/256
@mredlek commented on GitHub (Aug 20, 2023):
I made this work with a simple patch. I don't know enough about Go to make a PR for this: some details might not be optimal or just working for me.
The point is that the received url is before the reverse proxy. The request is not actually send, but handled as if the application received it directly, which is after the reverse proxy. To make it work, it has to do the same rewrites a the reverse proxy would have done. Because the hostname seems to be ignored, I here replace the baseurl with `http://127.0.0.1"