From 662b558d211e34c083795dc3192fdf3a777d998c Mon Sep 17 00:00:00 2001 From: poprhythm Date: Fri, 13 Mar 2026 03:36:52 +0000 Subject: [PATCH] torrents: document NPM web UI instance labels (OPEN/VPN badges) --- torrents/NPM-WEBUI-LABELS.md | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 torrents/NPM-WEBUI-LABELS.md diff --git a/torrents/NPM-WEBUI-LABELS.md b/torrents/NPM-WEBUI-LABELS.md new file mode 100644 index 0000000..0f5f9d9 --- /dev/null +++ b/torrents/NPM-WEBUI-LABELS.md @@ -0,0 +1,55 @@ +# qBittorrent Web UI Instance Labels + +The `open` and `vpn` instances are proxied via nginx-proxy-manager and have colored +badges injected into the Web UI to distinguish them at a glance. + +## How it works + +nginx's `sub_filter` module replaces `` in the HTML response with a `'; +sub_filter_once on; +proxy_set_header Accept-Encoding ""; +``` + +**vpn:** +```nginx +sub_filter '' ''; +sub_filter_once on; +proxy_set_header Accept-Encoding ""; +``` + +## Important: manual fix required after saving in NPM UI + +NPM regenerates the nginx conf file whenever you save a proxy host in the UI, +which overwrites a necessary fix. After saving either proxy host, re-run: + +```bash +# For open (proxy host 4): +sudo sed -i 's| include conf.d/include/proxy.conf;| proxy_set_header Accept-Encoding "";\n include conf.d/include/proxy.conf;|' /srv/nginx-proxy/data/nginx/proxy_host/4.conf + +# For vpn (proxy host 28): +sudo sed -i 's| include conf.d/include/proxy.conf;| proxy_set_header Accept-Encoding "";\n include conf.d/include/proxy.conf;|' /srv/nginx-proxy/data/nginx/proxy_host/28.conf + +docker exec nginx-proxy nginx -s reload +``` + +### Why is this needed? + +`proxy_set_header Accept-Encoding ""` must be inside the `location /` block for +nginx to actually strip the header before forwarding to qBittorrent. When set at +the server block level (via NPM's Advanced tab), it is silently ignored because +the location block defines its own `proxy_set_header` directives via `proxy.conf`. + +Without this fix, qBittorrent returns gzip-compressed responses and `sub_filter` +cannot process them, so the badge never appears.