mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #1009] Feature request: Allow hosting / running the web app in sub path #707
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#707
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 @Raschmaschine on GitHub (Jan 23, 2024).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1009
Hello there! First of all, I'd like to thank you for your awesome work on ntfy so far. Very appreciated!
At the moment, I'm running ntfy in a Docker container and using an Apache-based reverse proxy to embed the service into a sub path of my current infrastructure's domain web server. The relevant part of the site configuration boils down to something like this:
As expected, this allows subscribing and publishing to topics in the documented ways using HTTP (Webhook or PUT / POST requests) or WebSocket like

PUT https://<My Domain>/ntfy/<topic>/send?...,https://<My Domain>/ntfy/<topic>,https://<My Domain>/ntfy/<topic>/ws. However, the web app underhttps://<My Domain>/ntfyorhttps://<My Domain>/ntfy/appfalsely interprets its sub path as topic namentfyand (according to my investigation) continuously tries to establish WS connections to/ntfy/ws. This path obviously does not exist or rather does not support WS.I'm not quite sure about how the frontend determines its "base directory" for resolving topic paths, but I guess it's always the server root, or it is using absolute paths.
Due to the strange behavior of the web app, I have disabled it using some RewriteRules and a CSP header until further notice, but I'd love to deliver a more decent solution. (I'm aware you can disable the web app entirely, but I'd like to keep it enabled for testing purposes on the local network)
Using a subdomain as proposed in #398 is not achievable in my use case due to underlying circumstances I cannot influence.
In view of a couple of other similar requests, please consider implementing this web app feature. If I find enough time, I'll try to implement it myself and do a PR.
💡 Idea
Add the ability to specify the base directory / sub path / subdirectory / root directory (However named) in ntfy's web app.
💻 Target components
Web GUI (only that, I guess)
Related to: #398, #256, #258
@IjvenR commented on GitHub (Jan 31, 2024):
I second this.
Love the functionality, integrates easily in home integration and many other things (I use it with Node-Red automation), but I have the same issue with the webapp.
For now I have the "push notification" running by rewriting the url in NGINX proxy over "https://my.domain/ntfy" but opening the webapp via this url results in css, js and other type files being pulled up as "https://my.domain/app.css" instead of "https://my.domain/ntfy/app.css".
when I'm inside the LAN I use the webapp over the direct http route, but I would love to be able to use it on the go as well.
Here is my NGINX config if somebody is looking for a solution.
Keep up the good work!
Kind regards,
IjvenR
@binwiederhier commented on GitHub (Mar 7, 2024):
I'd like that too, but honestly it requires too much work for too little gain. It does come up frequently, but it's likely going to break a bunch of things in various clients, so I wouldn't hold my breath.
@christaikobo commented on GitHub (Nov 30, 2024):
@binwiederhier Hi, I understand making subpath work for web app is probably a lot of hassle.
Is it possible to at least make it work for attachments and Email notifications? Right now if I specify subpath in base url the docker container simply refuses to start...It used to work in older versions. I can strip off subpath using my reverse proxy.
@manazoid commented on GitHub (Jan 9, 2025):
@binwiederhier Hello, why it is not planned yet? When I can wait the feature with subpath?
I need to put ntfy in traefik load-balancer. And it works fine with other software. But not with ntfy: /config.js breaks all logic of the application behind proxy.
@chudbigot commented on GitHub (Mar 5, 2025):
Here are 2 nginx.conf blocks to make files work as well (/files, because /ntfy/files would probably break in some clients)
/ntfy/app/ however is still broken and just displays a white screen without any css (or js?) for me. curling /ntfy/app/config.js returns
{"code":40401,"http":404,"error":"page not found"}(from ntfy, not nginx), but /ntfy/config.js works for some reason. Any idea how i can tell it to respect my sub-sub paths? I already tried settingweb-root:to/and curling /ntfy/, it looks exactly like http://127.0.0.1:2586/ but unlike connecting to it directly, it still throws me a white screen.I can also curl /ntfy/static/media/index-c5f33103.js, so I really don't see what the problem could be, unless there are some weird hard coded paths that should be easy to fix.
Anyway, ntfy with attachments works so far, so I won't complain, but I'd still like to see less spaghetti code with hard coded paths :)
@chudbigot commented on GitHub (Mar 5, 2025):
I would need to figure out how to set it up with email, but if this doesn't depend on J*vaScript, it should be fine. Actually, try copypasting my config blocks and adjust them for your sub paths as needed. Sadly I can't make it work as /ntfy/file/foo.bar, and have to rely on /file/foo.bar directly, so you'll have to sacrifice your /mail/ dir (or whatever email needs, I haven't read the whole docs yet) for it.
@NathanSweet commented on GitHub (Jan 4, 2026):
Hosting ntfy on a domain makes it discoverable with a port scan (subdomain is even worse). Running ntfy on a subpath prevents it from being discoverable, which is not crucial but nice.
@ksemele-public commented on GitHub (Feb 4, 2026):
+1 for proxy functionality