ntfy
ntfy copied to clipboard
Feature request: Allow hosting / running the web app in sub path
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:
<Location /ntfy>
ProxyPass http://<My Docker host's IP>:<ntfy port> upgrade=websocket
ProxyPassReverse http://<My Docker host's IP>:<ntfy port>
</Location>
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 under https://<My Domain>/ntfy
or https://<My Domain>/ntfy/app
falsely interprets its sub path as topic name ntfy
and (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.
:bulb: Idea Add the ability to specify the base directory / sub path / subdirectory / root directory (However named) in ntfy's web app.
:computer: Target components Web GUI (only that, I guess)
Related to: #398, #256, #258
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.
location /ntfy {
rewrite /ntfy/(.*) /$1 break;
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 3m;
proxy_send_timeout 3m;
proxy_read_timeout 3m;
proxy_redirect off;
client_max_body_size 0; # Stream request body to backend
}
Keep up the good work!
Kind regards, IjvenR
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.