Commit graph

2819 commits

Author SHA1 Message Date
Tom Winnerl
b9c19d9db4 fix(review): give the dry-run test's access stub the admin checks
The opt-in nginx dry-run test (NPM_TEST_NGINX=1) called
hostTest.buildHost() with an access stub that only had
token.getUserId. An edit runs the advanced config permission check,
which calls access.hasRole / access.token.hasScope, so the test threw a
TypeError before any of its dry-run checks ran.

The stub is now shaped like lib/access.js. The test also checks that the
permission path really runs: a user without admin rights can test an
edit, but not one that changes the advanced config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
ea4109965f fix(review): count a resolver-only main target as a warning, not healthy
A name that only resolves through /etc/hosts or a resolv.conf search
domain (resolver_mismatch) works for a static upstream only. nginx
resolves a proxy_pass with a variable per request through its own
resolver, which reads neither: the main target of every proxy host
(proxy_pass $server) and a custom location in dynamic mode fail at
request time. The health monitor and the config test still counted such
a target as ok, so the host showed healthy.

The probe is unchanged (POST /upstreams/check still answers ok with code
resolver_mismatch). Only the interpretation is per target:
forResolverTarget() marks a resolver_mismatch as not ok, with a message
that says requests fail, for the main target and the locations saved
(health monitor, from meta.nginx_locations) or rendered (config test,
from the dry run's location states) in dynamic mode. Static locations
and streams stay ok. The frontend shows resolver_mismatch as a yellow
warning whether ok or not, and the host status lists it as "nginx can't
resolve" instead of "not reachable".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
f992f5e6f7 fix(review): test a disabled host as it runs once enabled
The config test of an existing host merges the payload over the stored
row, so a disabled host kept enabled: false (the form never sends
enabled). The host templates wrap the whole server block in
{% if enabled %}, so the dry run checked an empty file and nginx -t
passed whatever the host contained: a disabled proxy host with an
unknown directive in its advanced config got "Configuration OK" and
then failed as soon as it was enabled. A new host only defaulted to
enabled when the payload left it out.

buildHost() now always returns the host with enabled: true
(asEnabled(), the same rule buildTestTargets() already used for the
reachability checks, now shared). The host is a copy that is only
rendered, never saved: the stored row stays disabled and dryRun() puts
its previous (empty) config file back.

Tests: test() of a stored disabled proxy host and of a new host sent
with enabled: false hand an enabled host to the dry run while the row
stays disabled; buildHost() does not change the row it builds on;
asEnabled() returns a copy. The HostConfigTest Cypress spec disables a
proxy host, tests it with an unknown directive (ok: false) and without
(ok: true), and checks that it stays disabled and is not served. The
docs mention it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
31e8b6f610 fix(review): keep npm.hide containers out of the DNS discovery results
npm.hide=true was only honoured by the Docker provider. DNS discovery
(on by default) sweeps NPM's subnets through Docker's embedded DNS and
can't read labels, so it found the hidden container again, and the merge
(deduped by host) put it back into the upstream picker as a "Discovered
on network" entry, against the documented "never suggest this
container".

discoverDocker() now also reports the names (container names and the
compose service alias, lower case) and the IPs on all networks of the
hidden containers (collectHiddenTargets()). runDiscoveryProviders() drops
every DNS item that matches one of them by name or by IP
(excludeHidden()); the IP also catches a PTR name that differs from the
container's names. The hidden names stay inside the backend and the 30 s
cache holds the filtered list. History items (hosts the user typed) are
kept. When Docker discovery is off or fails, nothing is known about the
labels and the DNS results stay as they are: the docs and the in-app help
say so and name the alternatives.

Tests: collectHiddenTargets() on the fixture and on a container with
several names, a compose service and two networks (self and junk
ignored), discoverDocker() returning the hidden set, and excludeHidden()
by name, by IP, keeping docker/history items, and with the merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
7ca825a00b fix(review): keep a picked container's host when it also fills in the port
Picking a container in a custom location's upstream field makes two
changes in the same event: UpstreamField reports the new host, then the
port/scheme hints of the candidate. LocationsFields built both updates
from the rows captured at render time, so the second update (port and
scheme) started from the old row and overwrote the first one, in the
local rows as well as in Formik. The field showed the picked name (it
keeps its own input text), but the form held the old host with the new
port: saving sent traffic to the old host on the container's port.

The rows are now kept in a ref that every change updates before it is
applied (add, remove and field changes), so several changes in one event
build on each other and the last setFieldValue holds all of them.

Tests: the "picked candidate" test now checks the form values, not only
the inputs, and a new test picks a container with port and scheme hints
and checks the submitted location (host, port and scheme together).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
9990aca66d ui: in-app help for Docker discovery, copyable code blocks
The picker said to 'see the docs' without saying which; there were none in
the app. Its footer now links a new help page (Docker discovery: socket
proxy, the two variables, Unraid note, labels, troubleshooting) and also
shows why discovery fails when it is on but not working. Code blocks in help
pages and the From Docker compose example get a copy button that also works
over plain http (port 81).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
ba4ce910a2 feat: create proxy hosts from Docker labels
Containers found through the Docker API now carry a proxy host suggestion
built from their npm.* labels (npm.domain, npm.port, npm.scheme,
npm.websocket, npm.block_exploits, npm.caching, npm.http2). Domains are
validated like the proxy host domain field (a leading "*." wildcard is
allowed); dropped entries come back as suggestion.ignored_domains.
existing_host_id / existing_host_type point at a proxy, redirection or 404
host the user can see that already serves one of the domains, computed per
request so the shared discovery cache is never changed.

A "From Docker" button on the proxy hosts page (shown when the user can
manage proxy hosts and Docker discovery works) lists the containers with
an npm.domain label, fetched fresh each time the list opens. Create opens
the proxy host form prefilled from the labels, Open edits the host that
already serves the domain. Containers without npm.domain are listed
collapsed and prefill only the target; the empty state shows a compose
example with the labels. npm.http2 only takes effect once the host has a
certificate: the form turns HTTP/2 on when one is picked.

Schema, docs (label reference), backend, frontend and Cypress tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
9a38839958 ui: "Test" button in the host modals checks the settings without saving
Proxy, redirection, 404 hosts and streams. The button validates the form
like Save, sends it to POST /api/nginx/<type>/test and shows the result
inline: "Configuration OK" (yellow "OK, with warnings" when a location or
target won't work yet) with the per-location states and target
reachability, the same nginx error as a failed save (switching to the
failing custom location), or the locations nginx would disable. A notice
appears when the form changed after the test. No toasts: the modal stays
open and nothing is marked as saved.

The custom locations and upstream discovery docs describe the test, and a
Cypress spec covers the four endpoints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
18d4156c51 feat: test a host's config without saving (POST /api/nginx/<type>/test)
For proxy hosts, redirection hosts, 404 hosts and streams. The request
body is validated like a create/update (400 on invalid input), then the
host config goes through a dry run with nginx -t. The result says whether
nginx accepts the host, with the same humanised error a save would fail
with, the state of each custom location and the reachability of the
upstream targets, plus warnings (e.g. a certificate that would only be
requested on save, or broken configs of other hosts).

The dry run has no side effects: the host's file is only written for the
test, no meta is patched, no .err file is touched, nginx is not reloaded,
and broken files of other hosts are moved aside for the test and put back
byte-identical instead of being repaired. A host that doesn't exist yet is
rendered under a reserved, non-numeric name whose files are always removed.

Needs the create permission, or update when an id is given. As on save,
users who aren't admins can't test an advanced config of their own (403
before nginx -t runs; locations without one keep the saved one). Tests are rate
limited and the targets they probe count against the per user budget of
POST /upstreams/check (lib/upstream/check-budget.js); with the budget used
up nginx is still tested and the targets are reported as rate_limited.
Unit tests cover the result building and the dry run (an opt-in test,
NPM_TEST_NGINX=1, runs it against a real nginx).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
1900606f98 docs: upstream discovery page
Describes where the forward host suggestions come from (hosts used before,
Docker embedded DNS, the Docker API with a recommended docker-socket-proxy
setup and container labels), the reachability check and its result codes,
the background health monitor, the environment variables, permissions and
limits, and the API. The custom locations page links to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
4c788dcdac frontend: upstream picker, live reachability check, health in the host status
- UpstreamField replaces the plain forward host inputs of proxy hosts,
  custom locations and streams: a combobox with the suggestions from
  /api/upstreams/candidates grouped by source (used before, network DNS,
  Docker), their ports and the hosts that already use them. Free text
  still works; picking a candidate also fills in the port and scheme,
  unless the user already changed them.
- While editing, the forward host and port are checked with
  /api/upstreams/check (debounced) and a badge shows whether the target
  is reachable, explains why not, or notes that a variable host such as
  $backend can't be checked.
- The host status in the proxy host and stream tables includes the
  health monitor results: an online host with an unreachable upstream
  shows as a warning and the status popover lists the failing targets
  (a location that is already reported as unresolved isn't listed twice).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
6dafc15686 test(upstreams): unit tests and Cypress spec
Unit tests for candidate merging, the reachability check, DNS and Docker
API discovery (with recorded Docker API fixtures), the health monitor and
the shared helpers. The Cypress spec exercises the /api/upstreams endpoints
against the e2e stack, including permissions and validation errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
6bd369299a feat(upstreams): discovery, reachability check and health monitor
New /api/upstreams endpoints that help picking and watching forward hosts:

- GET /upstreams/candidates suggests upstreams from three sources: hosts
  already used by other proxy hosts/streams, containers found through
  Docker's embedded DNS on the networks NPM is attached to
  (NPM_DNS_DISCOVERY, on by default) and, opt-in, containers from the
  Docker API (NPM_DOCKER_DISCOVERY + DOCKER_HOST, e.g. a docker-socket-proxy).
- POST /upstreams/check resolves a host with the same resolver nginx uses
  and opens a TCP connection to the port, returning a status code
  (ok, dns_not_found, tcp_refused, ...) and the round trip time. Checks
  are rate limited per user and can be turned off with NPM_UPSTREAM_CHECK=false.
- GET /upstreams/health returns the results of a background monitor that
  checks the targets of all enabled hosts every NPM_UPSTREAM_HEALTH_INTERVAL
  seconds (default 60, 0 turns it off). It shows the hosts the proxy host
  and stream lists show the user (with proxy hosts shared through
  permissions.meta.proxy_host_ids). The monitor starts with the backend
  and stops on SIGTERM.

Access is controlled by the new upstreams:discover permission (users who may
manage proxy hosts or streams); access.can() gets a quiet option so this
lookup doesn't log a denial for every request. The OpenAPI schema
documents the three paths and their result objects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
a5cc8f9cd9 fix(review): read unclosed strings in Lua blocks in linear time
In a *_by_lua_block, a quote without its closing quote on the line is an
ordinary character, so the scan went on from the next character and
started over at every later quote: a line of escaped quotes (`\"`) was
rescanned to its end from each of them, 2.8 s for 90 KB. Every later
quote of the same kind before the end of that line is unclosed as well
(the first scan stepped over it as an escaped character), so it is no
longer rescanned. Same results as before: 0 differences over 300,000
random Lua snippets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
6f9489c54e fix(review): keep the proxy host form read-only while a save is in flight
Only the custom-location fields were read-only during a save. A save that returns warnings keeps the modal open and resets the form to the submitted values, so an edit made meanwhile on the Details or SSL tab was lost. All tabs are now in a disabled fieldset while the save runs, as LocationsFields already was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
b19074405e fix(review): tell unresolved and rejected custom locations apart in the proxy host help
An unresolved location stays enabled and answers 502 until its host resolves; only a location nginx rejects is set aside and needs a save to come back. The help (en, de) said both were disabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
3d75f18f3b fix(review): apply rewrite-phase guards of included files to cached assets
With a top-level include the nested asset location left the include out (a second copy can break nginx -t) and so skipped an included guard like if ($http_x_token != secret) { return 403; }: /cincg/app.css reached the upstream without the token. The include reader now returns the rewrite-phase statements (set, if, rewrite, return, break, set_*, set_by_lua*) at the top level of the included files, nested includes in place, and the asset copy puts them where the include was, on its line. An include the backend can't read is kept as it is in the copy, so the location is set aside by nginx -t rather than served without it. The harness expectation of /cincg/app.css is now 403 without the token (real nginx, static and dynamic). Develop's nested assets.conf location skips such a guard too (checked on real nginx: page 403, asset 200).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
a30fdeb7ab fix(review): keep $uri live in rewrite-phase statements of the cached-asset copy
The nested asset location replaced $uri in every statement of its copy of the advanced config with a snapshot taken before anything ran. A guard after the user's own rewrite (rewrite ^/files/alias/(.*)$ /files/private/$1; if ($uri ~ ^/files/private/) { return 403; }) then checked the old path and the protected asset was proxied. Rewrite-phase statements (set, if, rewrite, return, break, set_*) now read $uri itself (they run before the generated rewrite), and the snapshot is taken again right before the generated rewrite for the later phases. Semantics harness case /crwg/: the guarded asset gets 403 (real nginx, static and dynamic).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
3d56787f40 fix(review): keep $uri of cached assets of a location with a forward path
The nested asset location of a location with Cache Assets and a forward
path always runs `rewrite ... break` (nginx forbids a URI part in
proxy_pass inside a regex location), so its copy of the advanced config saw
the forwarded path in $uri (/v1/app.css) while the location itself, static,
saw /api/app.css.

The asset location now sets $npm_loc_<i>_uri to $uri before anything else,
and its copy of the advanced config reads that variable instead of $uri,
${uri}, $document_uri and ${document_uri} (token ranges from the nginx
tokenizer, not in comments or *_by_lua_block bodies). The location itself is
unchanged. Docs name the remaining limits (settings inherited from a
top-level include, Lua ngx.var.uri). New harness case /curi/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
8fb231890b fix(review): keep a location static when an included file reads $uri
chooseLocationMode() looked for $uri / $document_uri only in the location's
advanced config, so a location with a forward path whose included snippet
reads $uri (proxy_set_header X-Original-URI $uri;) was rendered dynamic and
the rewrite changed what the snippet sent on a healthy upstream. The include
reader now reports usesUriVariable for any statement of an included file
(nested includes too), and the location stays static then, as for the
variable written directly. Docs say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
cbcfa3b9de fix(review): rank hosts with problem locations in the status column
The status column sorts by the status it shows (pr/1); the warning state of
a host with quarantined or unresolved locations now sorts right after the
hosts nginx rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
6d02ea2168 fix(review): keep stored forward hosts that combine text and a variable
A location saved before v2.17 with forward host `app-$stage` (and
`set $stage prod;` in its advanced config) answered 503 after the startup
regeneration: preflightLocation() only allowed a host that is exactly one
`$name` and quarantined every other host with a `$`. The renderer before
custom location modes, and develop, write any stored value that can't add
directives literally (`proxy_pass http://app-$stage:80;`), which works.

isVariableHost() now accepts a forward host with an nginx variable that has
none of the characters that would break out of the directive, the same
structural rule as lib/nginx-values.js applies to stored rows: such a host
is rendered literally (static, no DNS check, no rewrite) as `$backend` is,
also with NPM_LOCATION_DYNAMIC_DNS=false. Braces (`app-${stage}`), spaces
and `;` are still quarantined. The API refuses `$` in a forward host since
v2.17, so this only concerns rows saved before. The frontend's
isVariableHost() follows the same rule (no upstream check for such hosts).

Tests: unit tests for the preflight, mode and rendering; nginx semantics
harness cases /varmix/, /varmixfp/ and /vmrx/ (`ec$semhost`) compared with
the legacy rendering (they answered 503 before, DIFFS=0 now).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
063dd7618a fix(review): quarantine a location whose included snippet is broken
A custom location with `include /snippets/app.conf;` whose file has an
error (eg. an unknown directive) still rejected the whole host save: nginx
names the included file (`/snippets/app.conf:1`), which is no host's
config, so configureHost() treated it as a global error and never tried
the location isolation. Unrelated changes to the host could not be saved,
although replacing that location with a 503 stub lets the host work.

For an error in a file that is no host's config, configureHost() now runs
isolateFaultyLocations() over the locations whose advanced config has an
`include` statement (comments don't count): the location that brings the
error back is quarantined and the host stays online. When the error stays
with all of them stubbed (eg. a broken file that nginx.conf includes) it
stays a global error, and a host without such locations costs no extra
nginx -t.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
abcf0af67c i18n(locations): translatable location check messages
The state of a custom location (location editor, save warning, host
status popover) showed the backend's English sentence in every language.

Backend: every entry of meta.nginx_locations now has a stable `code`
(empty_path, empty_host, invalid_host, invalid_path, unbalanced_braces,
regex_forward_path, named_forward_path, unresolved, rejected, omitted)
and `params` (`host` for unresolved, nginx's error as `detail` for
rejected and omitted, a sentence of its own like a host-level error's
detail) next to the English `message`, which stays for API users and
logs. An unsafe location value names its field (location_path,
location_forward_host, location_forward_path) like the host's own. OpenAPI schema, docs, unit tests and the Cypress spec
cover the new fields.

Frontend: the text comes from location-check.<code> (en, de, et, vi;
invalid_path and rejected reuse location.error.path-invalid and
location-status.quarantined.default), nginx's own error is shown below
it untranslated. An unknown code shows the backend's message.

The English plurals of "+{count} locations", "{count} problems" and the
two save warnings use `=1 {...}`, so languages without a "one" category
(ja, zh, ko, id) that fall back to English read "1 location", not
"1 locations".

A host rejected because of a custom location ('Custom location "/api"
advanced configuration: ... (line 2).') is worded by describeNginxError()
from the details' area (location, location_advanced), location_path and
relative_line: nginx-error.location and
nginx-error.location-advanced-line (en, de, et, vi), nginx's error below
it untranslated. The hint of the regex/named forward path rule follows
its new English text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
74dc14841a chore: adapt to develop nginx-values (location values the API accepts)
v2.17 validates custom location paths, forward hosts and forward paths in
the API schema (lib/nginx-values.js) and maps $forward_host from $host.

- frontend: the location editor checks what the API now refuses, so the
  user gets an inline error instead of a 400: no "$" (nginx variable) in
  the forward host, no braces (`${name}`) or control characters in the
  forward path, the location path rule of the API, and these checks also
  for a disabled row (the schema checks every row). Path and forward host
  are trimmed before sending, the schema refuses surrounding whitespace.
  location.error.host-invalid no longer says a single variable is allowed
- backend: location paths are read with nginx's escapes (`/a\;b`,
  `"/a\"b"`, `/a\\b`, which the API accepts), and the dynamic rewrite
  writes a backslash of the path as \x5c, so it matches the URI nginx
  matched the location with
- tests of the advanced config check of non-admins follow upstream's
  value matching (renames keep the config, swapping and clearing are
  allowed, copies are refused); a location sent without a config keeps
  the one of the n-th saved location for the n-th repeated (regex) path
- new test: the accepted values of nginx-values.test.js rendered through
  the location renderer in static, dynamic and asset-cache mode keep the
  statement structure, and the dynamic rewrite matches escaped paths
- nginx semantics harness: upstream's $forward_host map, upper-case Host
  requests, escaped and quoted location paths (DIFFS=0)
- docs: a variable forward host only renders for locations saved before
  v2.17, braced variables in the forward path are refused
- generateConfig checks a host's locations as they are rendered
  (prepareLocation(): trimmed, "host/path" split): a stored `/api ` or
  `app ` renders and is safe, so the startup reconcile after an upgrade
  doesn't take such hosts offline; an empty path or forward host is left
  to the per-location quarantine instead of taking the whole host offline
- ProxyHostLocations.cy.js: the duplicate path case sends `/same` twice,
  the schema refuses surrounding whitespace before the duplicate check

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
66fd585a3f fix(review): honour a proxy_redirect from an included file
In dynamic mode (the default whenever a resolver exists) a location writes
its own `proxy_redirect <upstream> /` line unless hasDirective() finds a
proxy_redirect in the advanced config text. An advanced config with
`include /snippets/x.conf;` whose file has `proxy_redirect off;` then
failed nginx -t ("proxy_redirect" directive is duplicate; develop passes)
and the location was quarantined (503). An included rule with a value got
NPM's line next to it, which the literal rendering doesn't have (no
implicit "proxy_redirect default" once a rule is set).

lib/nginx-includes.js reads the files the top-level includes of a
location's advanced config bring in, as nginx does: relative paths from
the config prefix /etc/nginx/ (also in nested includes), globs as glob(3)
expands them (no match is no error, a wildcard doesn't match a leading
dot, `\` escapes), nested includes up to 16 levels, only the top-level
statements of each file (the location context), read with the Lua-aware
tokenizer. One reader per computeLocationStates() / renderLocations()
call caches the files; the file access is injectable for the tests.

Rendering is synchronous, so a read must never block or run away: only
regular files up to 4 MiB are read (stat first, then open O_NONBLOCK and
fstat again). A character or block device (/dev/null, /dev/zero,
/dev/urandom) is never opened and reads as empty, as nginx reads st_size
bytes, 0 for a device. A FIFO, a socket or a bigger file is unreadable.

A proxy_redirect at the top level of an included file counts as the
user's: no npm_redirect line (the nested asset location already sets none
with an include and inherits the location's). An include that can't be
read (missing file, no permission, a directory a glob can't list, wrong
number of arguments, a cycle or deeper nesting) keeps the location static
while its host resolves, as before dynamic locations; an unresolved host
stays dynamic and fails closed as before.

Tests: the reader (off, a value, nested and relative includes, globs,
missing / unreadable files and directories, cycle, depth, caching,
devices, FIFO, socket, size limit) and
the rendering and mode choice with it; harness cases for dynamic locations
that include `proxy_redirect off;` (directly, through a glob and a nested
include, with Cache Assets) and a rule that matches nothing: nginx -t
passes and the Location header is the same as static and legacy. Docs:
docs/src/advanced-config/locations.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
725f963eb3 fix(review): tokenize *_by_lua_block bodies as Lua
lib/nginx-tokenize.js read the body of an access_by_lua_block,
set_by_lua_block $v, rewrite_by_lua_block, ... with nginx's rules, but
lua-nginx-module reads it with a Lua lexer of its own. Valid OpenResty
blocks were quarantined as "unbalanced { } braces" before nginx was asked:
a `}` in a Lua comment (`-- deny unless header }`), a `#t` (no comment in
Lua), strings with braces, long strings and comments ([[...]], [==[...]==],
--[[...]]).

The tokenizer now skips the block of every directive ending in
_by_lua_block (ssl_*, balancer_, log_, ... included) the way
ngx_http_lua_conf_lua_block_parse() does: `{` / `}` count outside of
one-line "..." / '...' strings, long brackets with the same level and
`--` comments. The Lua block is one statement (lua: true) with its end
offset and no statements inside, so the brace check, the asset copy of the
advanced config (the block is repeated as it is) and the include / log path
check (Lua code is not read as directives) see it as nginx does. An
unclosed Lua block or long bracket counts as unbalanced. The header comment of
lib/nginx-advanced.js and docs/src/advanced-config/locations.md no longer
say a quote in a Lua comment can hide the directives after the block from
the include / log path check.

Tests: tokenizer cases checked against nginx -t of openresty 1.31 (blocks
that pass and blocks that fail), every *_by_lua_block form, the brace
check, a Lua guard repeated in the asset location with and without an
include; harness cases for an access_by_lua_block guard with a `}` in a
comment on cached assets, with and without an include.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
7bca4cc170 fix(review): run cached assets of a location through its whole advanced config
The nested asset location of a custom location with "Cache Assets" only
repeated the top-level `set` statements of the advanced config. nginx runs
none of a parent's rewrite-phase directives in a nested location, so an
`if (...) { return 403; }` guard, a `rewrite` or a `set` inside an `if` were
skipped for assets: `^~ /private/` with `set $backend app; if
($http_x_token != secret) { return 403; }` served /private/file.css without
the token.

The asset location now repeats the location's whole body (templates/
_location_body.conf): the advanced config at the same place before the proxy
directives, the access list, headers, exploit / SSL / HSTS includes and the
proxy settings, plus the cache settings. assetSetDirectives() is gone.

- top-level `location` blocks of the advanced config are left out of the
  copy (nginx rejects a prefix location inside a regex location); their lines
  stay as empty lines so error lines still map to the advanced config
- a cache directive the advanced config sets itself at the top level
  (expires, proxy_cache, proxy_read_timeout, ...) is left out of the cache
  block: nginx rejects most of them twice, and the location's value applies
- an advanced config with a top-level `include` is not repeated as a whole:
  the included file is unknown here, and a second copy of it fails nginx -t
  (Authelia's proxy.conf: "proxy_read_timeout" directive is duplicate; an
  included `expires`; an included `location`, "is outside location"). The
  nested location then repeats the advanced config without the includes and
  without the list settings a nested location only inherits while it sets
  none of its own (proxy_set_header, add_header, more_set_headers, allow /
  deny, error_page, auth_request_set, limit_req, set_real_ip_from,
  proxy_redirect, valid_referers, mirror, error_log, *_types, ...), and sets
  no proxy_set_header / add_header / access / websocket / proxy_redirect
  lines of its own, so it inherits the location's lists, the included
  entries too (auth_request, headers, access list, Authelia's
  "proxy_redirect http:// $scheme://;"). Everything else
  is repeated, so a guard reading a variable of set_by_lua_block or set-misc
  (set_if_empty, set_unescape_uri, ...) applies to assets as well. A
  proxy_hide_header written in the advanced config is repeated (the asset
  block has its own list); rewrite lines and proxy_hide_header inside an
  included file don't apply to assets (documented)
- a top-level proxy_store (not off) leaves proxy_cache out of the cache block
  like a cache directive of the advanced config: nginx -t rejects both in one
  location ("is incompatible")
- the tokenizer records statement offsets, ends and block ends for that

Docs: assets behave like the location; the `set` limitation and the `map`
advice (map is not allowed in a server block) are removed.

Tests: unit tests for the copy, nested locations and own cache directives;
harness cases for a 403 guard on cached assets (also after a cached hit), a
rewrite, a set inside an if, a nested location block and an access list;
unit and harness cases for includes (Authelia-like proxy.conf with cache
directives and proxy_set_header / add_header, an auth_request snippet with
nested locations, an included guard, set_by_lua_block and set_if_empty
guards next to an include, proxy_store with and without an include, an
included proxy_redirect, valid_referers both included and direct).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
4d309a369f fix(review): keep cached assets of a variable proxy_pass on the location's upstream
With Cache Assets enabled the host's server block includes the host-level
asset regex (conf.d/include/assets.conf, proxied to the main upstream) before
the custom locations. Without a nested asset location that regex wins over a
prefix location, so a forward path such as /api/$arg_id sent
/api/app.css?id=5 to the main upstream with the original URI instead of
/api/5 (the same for a variable forward host).

Every prefix/regex location with Cache Assets gets the nested asset location
again. For a variable forward host or path it repeats the parent's proxy_pass
as it is (no rewrite, proxy_redirect off like the parent), and every nested
asset location now repeats the top-level `set` statements of the advanced
config (read with lib/nginx-tokenize.js), so /v1/$target with
`set $target t;` still reaches /v1/t. The nested regex group is
non-capturing, so $1 of the parent is kept. A `set` inside an `if` or other
block is not repeated (documented).

test/nginx-semantics renders the cached cases with the full host template
(proxy_host.conf, :8012/:8013) against a main upstream on echo:9001 and
flags any response from it unless expected; new cases /api/ ->
/api/$arg_id, $backend with and without a forward path. With the previous
renderer the harness reports 9 differences, now 0. A regex location's
assets still go to the main upstream (the host-level regex comes first), as
on develop; documented and covered by /cachere/app.css.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
18c882ee9e fix(review): keep the location editor and the form value in sync around a save
Locations could be edited while a save was in flight. When the save
returned a warning, resetForm restored the submitted values, but
LocationsFields kept showing its newer local rows, so the next Save sent
older locations than the editor showed.

The location editor is now read-only while the modal saves (a disabled
fieldset, the access list select disabled, handlers ignore changes), and
its rows follow the Formik value when it is replaced from outside, eg. by
resetForm (row ids kept by position, so open rows stay open). The access
list select is controlled so it shows the reset value too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
718f79ec3f fix(review): no nested asset location for a variable forward path
With Cache Assets enabled, a forward path such as /v1/$target could read a
variable set by `set $target ...;` in the location's advanced config. The
nested asset location used that path but never ran the parent's `set`, so
asset requests went to /v1/ instead of the intended URI.

A forward path with any nginx variable now gets no nested asset location
(like a variable forward host): its assets go through the parent's
proxy_pass, uncached. Adds unit tests and a nginx-semantics case
(/cvt/, caching + set $semtarget + /v1/$semtarget).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
c7c2551086 fix(review): regenerate locations when the dynamic DNS setting changed
Restarting with NPM_LOCATION_DYNAMIC_DNS=false (or without a resolver) did
not bring back literal upstreams for healthy proxy hosts: their configs
already had the current version marker, so the startup reconcile skipped
them. The config of a proxy host with custom locations now records the
setting it was rendered for (`# npm-location-dns: dynamic|static`) and the
reconcile regenerates it when that differs from the current setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
81ee5d6e7e fix(review): keep regex and named locations with a variable forward host
A regex or named location with forward host `$backend` and a literal forward
path (eg. `~ ^/api/` to `$backend/v1/`) was quarantined with a 503: the
preflight checks only looked for a variable in the forward path. A variable
anywhere in proxy_pass allows a URI on these location types, so nginx has
always accepted such a location. Variable hosts are exempt from both checks
now and rendered literally like before.

Tests: unit cases for preflight, mode and rendering; nginx semantics harness
cases for a regex and a named location with a variable host (DIFFS=0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
2bedec7f75 fix(review): let cached assets inherit a custom proxy_redirect
With Cache Assets on, the nested asset location always set its own
proxy_redirect. In nginx a proxy_redirect in a nested block replaces the
inherited one, so a rule from the location's advanced config (eg.
`proxy_redirect off;`) was ignored for asset responses.

When the advanced config has a proxy_redirect, the nested location now
sets none and inherits the user's rule. Without one it keeps the spelled
out redirect (or `off` for a variable forward path) as before. The
nginx semantics harness has a case with caching and `proxy_redirect off`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
b7c4f32c2f fix(review): keyboard navigation for the proxy host tabs
Problem: the proxy host modal's tabs became React-controlled links without
Bootstrap's data-bs-toggle, so Bootstrap's tab component (which handled the
arrow keys and moved the focus) no longer attached to them. The links kept a
roving tabindex (only the active one is focusable) but nothing handled the
keys: a keyboard user could reach only the active tab and never open Custom
Locations, SSL or Advanced.

Fix: the WAI-ARIA tabs pattern. ArrowRight/ArrowDown and ArrowLeft/ArrowUp
move to the next / previous tab (wrapping), Home and End to the first and
last; the tab is activated and focused. The tab strip gets role="tablist",
each tab an id and aria-controls, each panel aria-labelledby. Bootstrap's
data attributes stay off, React state keeps owning the active tab (the
programmatic switches after errors don't move the focus).

Tests: ProxyHostModal.test.tsx renders the modal and checks the tabindex of
the tabs, arrow / Home / End navigation with focus, other keys and clicks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
b7720afab4 fix(review): don't block saving because of a disabled location's host
Problem: validateLocations() ran the host format checks (whitespace,
characters such as ; $ { }, invalid characters in the host/path part) on
every non-blank row, also on rows switched off with `enabled: false`. The
backend never renders a disabled location (preflightLocation() stops at
`enabled: false`) and the API accepts such a host, so a stored location with
an invalid host could be disabled safely, yet the editor refused to save
the host until the disabled row was fixed or deleted.

Fix: a disabled row only gets the checks the API itself makes for every
row: required path and host, the port range, and duplicate paths (the
backend's findDuplicatePath() counts disabled rows too). Switching the row
back on brings the format errors back, because validation runs on every
change.

Tests: validateLocations cases for disabled rows (format errors skipped,
required / port / duplicate checks kept, the same rows enabled still
invalid) and a form test: a disabled row with a stored `app;legacy` host
submits, after switching it on the submit is blocked again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
07917e1893 fix(review): quarantine a location behind an error without a line
Problem: a custom location with `proxy_set_header X-Test $missing_variable;`
still blocked the whole host save. nginx reports `unknown "missing_variable"
variable` without file or line (variables are checked after parsing), so the
error never reached the per-location quarantine, which needs a line inside a
location's markers. The check without this host passed, so the save was
rejected as a "conflict with another host"; in bulk mode (startup, repair of
another host) the whole host went offline instead of the one location.

Fix: lib/nginx-locations.js gets isolateFaultyLocations(). When an error has
no line and only this host's config causes it (no file named and the test
without the host passes, or the host's file named without a line),
configureHost() stubs the rendered locations: if the error stays with all of
them stubbed it comes from the host itself and the result is unchanged.
Otherwise each location is rendered alone with all the others still stubbed,
and every one that brings the same error back is quarantined. Two broken
locations with the same message are thus both found, and a working location
is never quarantined for them (stubbing one at a time would leave the other's
identical error and blame every candidate). Only when none fails alone (they
fail only together) is each one stubbed alone and the first that makes the
error go away (or change) quarantined, all of them when none does. The loop
then tests the full config again, bounded by maxQuarantines as before. In a
nested configure it is skipped when the host being saved is the cause
(causedByProtected() handles that as before). After the search the config
that failed is written back to the host's file, so a host rejected at host
level in bulk mode keeps its real config as .err for inspection, not the last
stubbed variant.

When no location is to blame (the error stays with all of them stubbed,
or the host has none), the host level check from the feat(nginx) commit
applies as before: the host is only rejected as a conflict with another
host when the error goes away with every other host's config moved aside
(failsAlone()), otherwise it fails with a host level error such as
`Advanced configuration: unknown variable "$x"`.

Tests: nginx-location-isolate.test.js with unit tests for the search and
configureHost() against a fake nginx -t that reports unknown variables
without a line: the bad location is quarantined (503 stub) and the host
stays online; two bad locations with different variables are both
quarantined; two bad locations with the same variable around a clean one
quarantine only the two, the clean one stays ok; the same variable in the
host's advanced config still rejects the host at host level with an
"Advanced configuration" message (not a conflict with another host), also
for a host without locations, and in bulk mode its .err file holds the
real config (proxy_pass, the variable), not 503 stubs, and its nginx_err
names the advanced configuration.

Cypress (ProxyHostLocations): a location with `$missing_variable` is
quarantined with an unknown-variable message, the host stays online, its
other location serves and the bad one answers 503.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
798596ec79 fix(review): allow variable forward paths on regex and named locations
Problem: preflightLocation() quarantined every regex (`~`, `~*`) or named
(`@x`) location that had a forward path, so a working setup such as
`location ~ ^/api/(.*)$` with forward path `/v1/$1`, or `@fallback` with
`/fb$request_uri`, answered 503 after the upgrade. nginx only rejects a URI
in the proxy_pass of such a location when the proxy_pass has no variable
("cannot have URI part in location given by regular expression"); with a
variable it is compiled as a script and has always worked.

Fix: the check only quarantines a forward path without a `$`. A forward
path with a variable is rendered literally, exactly as before, through the
previous fix (static mode, no rewrite; no nested asset location when it uses
a capture, because the nested regex would replace $1). The messages and the
nginx error hint now say "without an nginx variable" and suggest a capture.

Tests: unit tests for the preflight (literal path still quarantined, `$1`,
named captures, `$request_uri`, named locations allowed) and the rendering.
The nginx-semantics generator now applies preflightLocation() like the
backend does, and new cases (`~ ^/rx/(.*)$` -> `/v1/$1`, `~*` with a named
capture, a cached regex location, `@fb` reached through error_page) must
answer like the old literal rendering: 9 diffs before, DIFFS=0 now.

Cypress (ProxyHostLocations): `~ ^/cap/(.*)$` with forward path `/$1` is
saved ok and `/cap/dashboard` serves examplesite's /dashboard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
7581f54320 fix(review): keep forward paths with nginx variables literal
Problem: a forward path that contains an nginx variable (`/api/$arg_id`,
`/api/${arg_id}/x`, `$request_uri`) was rendered like any other forward path
in dynamic mode: `rewrite "^/a/(.*)$" /api/$arg_id$1 break;` plus a proxy_pass
without URI. nginx sends a variable-containing proxy_pass URI as it is, so
before this branch `/a/foo?id=42` reached the upstream as `/api/42`. With the
rewrite it reached `/api/42foo?id=42`: the rest of the path was appended,
the query string kept, `$request_uri` re-escaped. The nested asset location
used the same rewrite in both modes, so cached assets went to the wrong URI
even for static locations.

Fix: chooseLocationMode() renders a location whose forward path contains a
`$` static, i.e. literally as before (`proxy_pass http://app:80/api/$arg_id;`).
A proxy_pass with variables is resolved by nginx per request anyway, so an
unknown host still doesn't fail `nginx -t`; a host that doesn't resolve keeps
the "unresolved" status. rewritesUri() is false for these paths, the nested
asset location gets the forward path as its proxy_pass URI and
`proxy_redirect off` (like its parent, "proxy_redirect default" is not
possible with variables), and it is not added when the forward path uses a
regex capture ($1), which the nested regex location would overwrite.

Tests: unit tests for the mode choice and the rendering (main and asset
location); nginx-semantics cases /av/, /avb/, /avh/, /avr/ and the cached
/avc/, with a new expected-response column in reqs.txt (static, dynamic and
the old literal rendering must all answer `/api/42`). Against the previous
renderer the harness reports 11 diffs, now DIFFS=0.

Cypress (ProxyHostLocations): `/q/` with forward path `/$arg_page` is
static and `/q/anything?page=dashboard` serves examplesite's /dashboard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
e4b7b806e7 docs: custom location modes and statuses
The "Host Status and Nginx Errors" page becomes "Custom Locations": how a
location reaches its upstream (dynamic / static), the location statuses, and
the location parts of errors, the API meta and startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
751199ecbc test(cypress): custom location resilience
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
8622239446 frontend: resilient custom locations editor and location status
- the status column shows Warning when a custom location is quarantined or
  unresolved, the popover lists those locations with the reason, and the
  destination column counts locations and problems
- the locations editor shows the server status of each location, can switch
  a location off, validates path, forward host/path and port like the
  server (incl. duplicate paths) before saving, drops rows that were never
  filled in, and opens the locations with errors
- a save nginx rejects inside a location switches to the Custom Locations
  tab and highlights that location; a save with quarantined or unresolved
  locations stays open with a warning
- the proxy host modal tabs are controlled, a blocked submit switches to
  the tab with the invalid field
- the proxy host search also matches location paths and forward hosts
- like the rest of the advanced config, a location's advanced config is
  only shown to admins; for the others it is sent back unchanged
- fixes: access list of a location is bound to the right row, the port is
  stored as a number, a location without a path is no longer dropped
  silently

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
2a1f794d30 test(backend): location rendering, DNS mode and nginx semantics harness
- unit tests for lib/nginx-locations.js (rendering, markers, forward path
  checks, duplicate paths, error line mapping) and lib/upstream-dns.js
  (mode choice)
- proxy-host-location-advanced.test.js: a user who isn't an admin can
  save, switch off and re-point locations, but not change, swap or add a
  location's advanced config, also with repeated regex paths
- test/nginx-semantics: renders a set of custom locations with the real
  backend renderer in the old, static and dynamic forms and checks with a
  real nginx that all of them answer the same (status, Location, body)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
7cc56f580e feat(nginx): render custom locations on their own, quarantine the broken ones
A broken or unreachable custom location no longer takes its proxy host (or
nginx) offline:

- custom locations are rendered by lib/nginx-locations.js, each wrapped in
  begin/end markers so an nginx -t error line maps back to its location
- the upstream host goes into a variable and is resolved by nginx per
  request (dynamic) where nginx's resolver knows the name; IPs, /etc/hosts
  names, names only the system resolver knows, nginx variables and
  locations whose advanced config reads $uri with a forward path stay
  literal (static). lib/upstream-dns.js makes that choice;
  NPM_LOCATION_DYNAMIC_DNS=false or DISABLE_RESOLVER keep everything static
- "Cache Assets" proxies assets of a location to that location's upstream
  (_location_assets.conf), not to the host's main upstream
- when nginx rejects a location, only that location is quarantined
  (return 503, or left out) and the save succeeds; forward paths nginx
  would reject are quarantined before the test
- locations can be switched off (`enabled: false`), duplicate paths are
  rejected on save, forward host and path are trimmed
- meta.nginx_locations reports ok / disabled / quarantined / unresolved and
  the mode of every location; proxy hosts with unresolved locations are
  retried after startup like hosts with an unresolved upstream
- the admin-only check of a location's advanced config matches the saved
  location by its trimmed path, the n-th location with a repeated (regex)
  path to the n-th saved one, so trimming and repeated paths don't refuse
  an unchanged config or let a changed one through
- error details name the location (scope `location`, location_index,
  location_path)
- configs written by an older version (version marker in proxy_host.conf)
  are regenerated on start

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00
Tom Winnerl
4594529dfe fix(review): only users who may list every host type see all nginx errors, filter stored nginx output
canSeeAllHosts() accepted any user with visibility "all", so a user who
can't list proxy hosts (eg. a streams-only manager) got the full details
of a global error naming a proxy host, or no host at all. It now also
requires view or manage on proxy, redirection and dead hosts and
streams; admins still see everything.

buildOfflineMeta() stored the unfiltered nginx output in a host's
nginx_details, which the host's owner reads: it now keeps only the
lines about the host's own error, like the redacted error responses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:49 +01:00
Tom Winnerl
3f100800bd fix(review): cap the expanded access_log paths checked for one advanced config
Each access_log was expanded to up to 64 paths built from the values
`set` in the same text, and every path was checked on its own, so
repeating `access_log $a$a$a$a$a$a;` after two long `set $a` values cost
statements x 64 x value length: a 99 KB config blocked the event loop
for 45 s. The expanded paths of all access_log statements of one text
now share a budget of 2,000,000 characters, and a text that needs more
is refused like one with too many expansions. Values set for the same
variable are collected without copying the list each time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:48 +01:00
Tom Winnerl
dbbe58b9aa fix(review): redact global nginx errors that name no host, and other hosts' lines in nginx output
A global nginx error about a file NPM doesn't manage (eg. /data/nginx/custom/http.conf) or no file has no
host_id, and redactConfigError() let it through: users who can't see all hosts got the raw nginx output
and message of an admin's file. Only admins and users whose visibility is "all" get those details now,
checked without a host row; everyone else gets the generic "redacted" error.

For users who can't see all hosts, nginx_output also only keeps the warnings that name the error's own
file and the error lines that name it or no file: warnings nginx printed before the error can name other
hosts' config files and server names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 08:24:59 +01:00
Tom Winnerl
6640536e70 fix(review): check advanced configs for forbidden file directives only after the permission checks, in linear time
The include glob check built a RegExp from the pattern, and runs of `*` (or `*?*?`) made it backtrack
exponentially: 2.4 s at 16 stars, about a minute at 24, on the backend's only thread. It ran in
sanitiseInput(), before access.can() and the admin-only advanced config rule, so a request without a
token could stall the backend.

- the check moved from sanitiseInput() into assertAdvancedConfigAllowed(), after the permission part:
  anonymous callers and users who may not set advanced config are refused before it reads the config;
  admins get the same validation errors as before
- glob segments are matched by a small matcher that only goes back to the last star (no RegExp from
  user input); runs of `*` collapse into one
- the self-`set` variable test no longer builds a RegExp either

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 08:23:11 +01:00
Tom Winnerl
765526c7be fix(review): expect the new previous-config wording in the German status popover test
Follow-up to the popover wording fix: the popover now says nginx did not apply the latest configuration and still runs the previous one, instead of 'offline' plus the previous-config line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 19:38:21 +01:00
Tom Winnerl
f1582ec8c1 fix(review): wait for the renew to start in the renew lock test, not a fixed 50 ms
The stubbed certbot renew resolves a promise the test awaits, so a slow certificate lookup under CI load no longer fails the intermediate assertion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 19:33:23 +01:00