diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c99c79..084f43c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,38 @@ Release history focused on **features, settings, default behavior, compatibility ## 0.43.0 — Unified info tooltips, Docker Headers section, FastCGI I/O buffering - **Information icons and bubbles:** every "i" information icon in the panel (Overview widgets, Cache settings, FastCGI profiles) and the Docker label help "?" button now share one look that follows Settings → Appearance (corner style, theme colors, UI scale). The "?" button still opens the label help dialog. Information bubbles open next to their icon, stay inside the visible area (horizontal shift, open upwards near the bottom), close on Escape or a click elsewhere, and only one is open at a time. Long help text inside a bubble is no longer collapsed to two lines in Settings. -- **Docker Vhosts:** "Diagnostic headers" becomes **Headers**. It contains the diagnostic header switches and, collapsed inside it, **HTTP policies** (previously a separately styled box below). The section summary shows which diagnostic headers are on and how many policy rules exist. Stored assignment fields (`timing_headers`, `backend_header`, `backend_timing_header`, `policy`) are unchanged. +- **Docker Vhosts:** **HTTP policies** is an ordinary service section with the same row style as Security, Cache or Proxy timeouts (previously a separately styled box). Its summary shows the number of rules; the Diagnostic headers summary shows which headers are on. Stored assignment fields (`timing_headers`, `backend_header`, `backend_timing_header`, `policy`) are unchanged. - **Custom locations redesign:** the location list is now a routing table — collapsed rows show order, state, ID, match, path/conditions, action and chips for settings that differ from the Vhost (access, headers, cache, balancing, HTTP policies, error fallback). An expanded location is split into **When** (match), **What** (action; only the fields of the selected action are shown) and **Options** tabs (Access, Headers, Cache, Errors, Backends & balancing, HTTP policies) with per-tab state. **Add location** offers starting points (backend path, Web Service, redirect, fixed response, internal `error_page` location, whole-host rule, empty). Existing locations open collapsed; a validation error opens the location and the tab that holds the field. No field, setting or behavior was removed: an unchanged save produces the same JSON as 0.42.4, and the same edit sequence (internal fallback location proxied to a dedicated backend, backend change, cache/method/rewrite changes, reordering, deletion) produced identical configuration and identical proxy responses in 0.42.4 and 0.43.0. - **Vhost editor layout:** the heading, status line and tabs stay at the top, only the fields area scrolls, and the save bar is a fixed footer of the dialog instead of a sticky element inside the scrolled content (expanded Custom Locations could leave the bar floating over the form). Switching tabs starts the new tab at the top. Verified in Chromium and Firefox. +- **Web Server panel redesign:** service cards follow the Vhost card layout — usage and backend labels (Static files, PHP-FPM, PHP-FPM: profile), ID and document root, Edit/**Copy**/Delete, and one detail strip per area (FastCGI backend, index/try_files, .htaccess with warning count, delivery, Cache-Control, hardening, used by). The editor opens with a **service type** choice (static files, SPA, PHP application with the existing WordPress/Drupal/Laravel/Symfony/Joomla/PrestaShop/generic presets, downloads, custom) that drives the existing presets, a General settings section, and the FastCGI / PHP tab moved next to Routing. The FastCGI tab chooses between **a shared FastCGI profile** (read-only summary, Edit profile, Manage profiles) and **settings of this service** (the local fields, shown only in that mode). **FastCGI profiles** show handler, usage and endpoint in the collapsed row, group the fields into Profile and connection / Timeouts and capacity / Custom parameters / PHP-FPM options, and can be copied. All controls follow the Appearance corner style, switch and interface-icon settings. Saving an unchanged service or profile, and the same edit sequence in 0.42.4 and 0.43.0, produce identical configuration. +- **Translations:** ACL default/rule actions use "Deny / Zablokuj" instead of the X-Frame-Options value "DENY"; translated remaining English labels in Polish (proxy timeouts, active health checks, sticky sessions, document root). - **Vhost / Custom location error fallback:** "Intercepted status codes" is replaced by a status picker (403, 404, 500, 502, 503, 504) labelled "Run the fallback for these upstream statuses", with clearer help that explains `error_page` semantics and scope (main route vs. one location). The target field suggests the IDs of enabled internal locations. Saved `error_fallback` JSON is unchanged; at least one status always stays selected, and statuses are inactive until a target is set. - **FastCGI / PHP-FPM:** TCP connections to the responder use `TCP_NODELAY`; request records are buffered (one write for requests without a body), responses are read through a buffer, and already-received `STDOUT` records are merged into larger body chunks without delaying streamed output. Measured on a local PHP-FPM 8.3 pool: about 5 instead of 15 read/write system calls per small PHP request and 13 instead of 27 for a 200 KB page; throughput on the 2-core test machine stayed within measurement noise. Timeouts, limits, error handling and truncation behavior are unchanged; new regression tests cover many small records with interleaved stderr and a 200 KB upload, prompt delivery of flushed output, and a truncated stream. - **Panel stylesheet cleanup:** removed rules for classes that no element uses (`cache-reason`, `runtime-information-grid`, `overview-layout-hidden-item`), 20 declarations that a later rule with the same selector always overrides, an empty rule, and two references to undefined custom properties (replaced by their effective fallback). Removed `app/dashboard-layout-editor.js`, which has not been part of the panel bundle since 0.33.7 and targeted elements that no longer exist. Rendering is unchanged. - Fixed the label of the selected-backend diagnostic header: it is `X-RustProxy-Backend`. +- **Appearance corner style everywhere:** 37 more bordered elements now follow Settings → Appearance → corners (previously always square): ACL policy cards, builder and preview with their condition/step tags, listener cards and active-listener summary, chip editors (hostnames, Prometheus CIDRs, stream sockets) and their chips, Vhost card charts, detail strips and live metrics, the "www" panel and the enable switch row, load-balancing simulator and HAProxy equivalent, route tester, header cards, previews and empty states, HTTP policy empty state, Docker service rows and agent summary, Settings shortcuts and the chart palette swatches. With the default corner style the panel looks exactly as before. +- **Language switch without reload:** TLS policy presets and help, the backend details toggle, the Docker "Live view" tooltip, the traffic chart legend ("Total"), and the Settings / Rules & headers tab labels for screen readers now follow a language change immediately. Polish: corrected missing diacritics in the diagnostic headers help, translated the OVH key fields, the ACME terms-of-service error and "Cold cache". +- **Narrow screens:** the Backends "Columns" menu on the Overview stays inside the screen on phones (it extended beyond the right edge at 390 px). +- **Redirects redesign:** tabs Details / Frontend / Rules · N. Rules are a rule table (order, state, match, path, status → target, chips for scheme, path and query handling and cache); an expanded rule shows **When** and **Where** with the target type as choice cards and a label that follows the type, plus Copy and Remove. **Add rule** offers five starting points. A URL tester evaluates the unsaved rules exactly like the proxy (verified against live responses for exact/prefix, strip/append/replace, query preserve/drop, percent-encoded and repeated slashes). Cards show state, rule count, listeners, certificate, protocols and the rule table, and can be enabled/disabled directly (disabling asks for confirmation). +- **404 hosts redesign:** tabs Details / Frontend / Response. The response type is chosen with cards (placeholder, application status page, Cloudflare style with variant, status only, custom HTML) and shown in a sandboxed preview with **Open in a new tab**. New endpoint `GET /api/pages/preview` renders local pages for the panel session with a `sandbox` CSP (scripts in custom HTML do not run); custom HTML is previewed from the saved host. Cards show state, status, listeners, certificate, protocols, Preview and an enable/disable action. +- **Streams redesign:** tabs Details / Listener & upstream / Backends · N / Health / Limits. Backends are table rows with live health and sessions, Copy and Remove; health checks of all backends are in the Health tab. Cards show the state, protocol, backend count and balancing, health summary, limits, per-backend health with colored state and the existing live metrics and chart; streams can be enabled/disabled from the card. +- **Fixed:** stream cards showed “Pending restart” for running streams because the status JSON (sorted keys) was compared as text with the configuration; structures are now compared. Hidden switch rows (`.check[hidden]`) stayed visible: the RFC2136-only “Sign SOA discovery query” option on other certificate sources, HSTS sub-options while HSTS is off and the passive health counters while passive health is off now hide as intended (their values were already ignored). The certificate source hint could show the raw key `providerHint_http01` until the language pack loaded. +- **Corner style:** location rows and their headers, header rows, policy builders, www domain pairs, Docker label help, agent security notes, HTTP listener rows, sparklines (clipped to the box) and the new editors follow the Appearance corner setting; the audit with all Vhost/Docker/Settings/Certificate tabs and sections expanded finds no bordered or filled element left out. +- Saving unchanged redirects, 404 hosts and streams produces the same configuration in 0.42.4 and 0.43.0; scripted edit sequences produce exactly the expected configuration. +- **Settings redesign:** search and the Security / Vhosts shortcuts share one toolbar; the tab list is grouped (Panel, Network & input, Traffic & responses, Observability, Administration, TLS & certificates) with the active tab marked like the other editors, and the search also hides empty groups. Sub-tabs inside settings pages and the certificate views (Installed / Renewal / Generate) use the underlined tabs of the Vhost editor. Documentation links are styled as links. +- **Docker agents (Settings):** each agent is a row (state, name and ID, endpoint, transport security, connection status, Enabled); expanded, it shows the provisioning code, diagnostics and four sections — Connection, Authentication & TLS, Domains & certificates, Default publishing (listeners, default backend IP, ACL profiles, Docker label publishing) — with Test connection and Remove. Every field and action of 0.42.4 remains; expanded rows stay open across live refreshes, and a validation error opens the row that holds the field. Help texts use the regular help style; the Agent ID field is aligned with the name. +- **Listeners (Settings):** an expanded listener is split into Identity & addresses and Protocols (with the HTTP/2 and HTTP/3 settings links). A validation error in a collapsed listener or any closed section now opens it before focusing the field. +- Saving every Settings form without changes produces the same configuration in 0.42.4 and 0.43.0; Docker agent and listener edit sequences produce exactly the expected configuration. +- **Default responses (Settings and Vhost → Pages):** every slot (direct IP, unknown host, static/maintenance host, unmatched path, each error code) is one compact row with when it is used and its current response; the selected row opens its response-type chips, Cloudflare variant, status and custom HTML. One shared, sandboxed preview shows the selected row (built-in pages are rendered live; custom HTML is shown in its saved version). Custom error pages show how many codes are set. All previous options and the "Switch all to Cloudflare style" switch are unchanged. +- **Admin API:** `GET /api/pages/preview` also accepts `slot` (`direct_ip`, `unknown_host`, `response`, `fallback`, `error-`) and optional `vhost` to preview saved custom HTML of global and Vhost default responses; the response stays sandboxed (`Content-Security-Policy: sandbox`) and same-origin framable only. +- **Cache settings:** a request flow (Client → Rules → HOT → COLD → Backend) built from the current form values — rules and bypass prefixes, memory and entry limits, cold cache, grace and stale-if-error — with HIT/MISS/BYPASS legend; each step opens its tab. The Resilience tab starts with a freshness timeline (stored → proactive refresh → TTL expired/grace → backend failing). No statistics are shown there. +- **Response transformation settings:** a flow (Backend → Decompress → Transform → Cache → Compress → Client) with the enabled operations and size limit, and a before/after example per type (CSS, JSON, HTML, SVG, JS) that shows what the built-in minifiers really produce. Each operation switch describes what it changes. +- **Security settings:** summary tiles (administrator and session, API tokens RO/RW, host access policies) that jump to their sections; the account section comes first. The host policy default decision is chosen with two cards, and a simulator tests client IPs against the policy being edited with the same rules as the proxy (deny wins, then allow, otherwise default; IPv4-mapped IPv6 as IPv4; hostname rules are not simulated). +- **Corner style, nested blocks:** a block inside a dialog, card, Settings page or floating panel (drafts dock, menus, popovers) uses a smaller radius than its container (subtle 3 px, rounded 6 px, extra 8 px) instead of the full surface radius, and a dialog body is no longer drawn as a second framed block inside the dialog. Draft rows in the drafts dock are flat list rows. Square style is unchanged. +- **Settings → Rules & headers:** the tabs and their pages are one card, like HTTP connections (previously the tab bar was a separate card above each page's own card); the section headings sit below the tabs. +- **Settings → Response transformation:** each operation is a small tile with its switch, name and a description below it (the description no longer squeezes in next to the switch). +- **Editor dialogs (Vhost, Redirect, 404 host, Stream):** the tabs follow the title row directly. The line between them moved: the backend health summary (or "save the vhost to start observing backends") is at the top of the Backend health tab, stream live metrics (sessions, RX/TX, errors) at the top of the Backends tab; the redirect/404 "ID · hostnames" line is dropped because the ID is in the title pill and hostnames are in the Frontend tab. +- **Debian 13 install/update script:** the build user's home (Cargo registry and Rust toolchain) moved from `/var/tmp/rustproxy-build` to `/var/lib/rustproxy-build`. systemd-tmpfiles removes files older than 30 days from `/var/tmp`, which left the Cargo registry incomplete and broke updates from source with errors such as "can't find `example` bin at `src/bin/example.rs`" (alloc-stdlib). Existing installations are moved automatically, and the extracted registry sources are refreshed before each build. ## 0.42.4 — Vhost/global error pages for generated Web Server and Basic Auth failures diff --git a/SHA256SUMS b/SHA256SUMS index 30c98b2..edb3777 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -2,7 +2,7 @@ 4140a2956264b44f259e6a37fc00ba02097bbe68b09296e04d3d243c1287129b .env.example 0a5e87541831edca0e7164c6469dba01a8a7053ab14dbfb8019c83e4db10edc2 .gitignore 903ca521af6ef7e54f83dc0b4b0436d116c88f064c36f0317b689b7cce79ab27 AGENTS.md -3bedb8644d82b2c306bea4caddb871b63b04d9ee093148bf5c92294384493f86 CHANGELOG.md +36b5e26d4f740fb562b3422a63708daaa49452dbb336d3826b448ef8a74116fa CHANGELOG.md 1ed75ec0adde5af3a0fe565689b45a973c5dad8a8e382ea279f631d9688f7326 Cargo.lock 8bfe4cf8793a43e61ad29a013092069381c51120f85c1ef358fd048d6a22556e Cargo.toml 788745d4f70a0382c6280020afbd48844bb2af65e835a826852143f8132cdeca Dockerfile @@ -39,7 +39,7 @@ f30c895df3d7f289f3b7c9a73969009ecf91110f59cb247daa242f68e78aa014 docker-agent/s 20313df0c14a1696d099ed881b159fe854e92538a60548a1729f92babaead881 docker-agent/system.go 188b74ec4f58da1b46d86925a67b6a590c92fb4fd7516e8d03d43871bc3b4542 docker-agent/system_test.go c4728da70d60d193c5c348d90c7c26ba1756d3459052a10a121f9be69a4dd18a docs/ACCESS.md -4359b18e07491d3388a8797633d18e3f2e1c4f3e7300850adc8eee048d66dd5b docs/API.md +7ef8cd7101cc5466f8c6e3ab327176e4dd68568a1d9b3306e12313fd178157dc docs/API.md 728b15b9825f547f34c4121219784798dd046fbbdd72ece8906d0cd77e8efc64 docs/BACKUP.md bfe96dd91dfc6e07918a662d98b036f12ceb011a5aa8381b3778bd0c964b19ab docs/CACHE.md 51d34823d139ff3b0b8e1cf1a31850746be5ed7da847a2cca51be36fd5f7733a docs/CACHE_TEMPLATE_LIBRARY.md @@ -47,7 +47,7 @@ bfe96dd91dfc6e07918a662d98b036f12ceb011a5aa8381b3778bd0c964b19ab docs/CACHE.md 81df6715e2f07617fe0bbb0960c4d5bdac28cf665ce7297fa3768118e6ab28ba docs/CONFIGURATION.md 32b076170bc2669d676ec78a067efec461a0072ddf8f68df1e7655b208e1c9c0 docs/CUSTOM_LOCATIONS.md 7b286e85330fad398fc6f9df1b894e004a42fb33ab7168eb93f87220a3bf5503 docs/DASHBOARD.md -7279ed7ac64d60ed96d90625dac494f305655883aba538c7b6fbcd0d801bdc99 docs/DOCKER_DISCOVERY.md +72398b5225b0ca9bc3f6c7aa7902e043678180e40b198156833b8e7504a72922 docs/DOCKER_DISCOVERY.md 279afcf0b5b8d2f8ef7b723ba0b5050ca4536f14445f3ee1b71e9f32b800bb9b docs/ERROR_PAGES.md 469e5d59d2fcab76f2610571cb9cbbba51cbadb40fec2495b3389a94f0c7b591 docs/FASTCGI.md 01b6d461d6b17b321d63cfb51435814858b29b437ed3e0bb13aba4351eaaf735 docs/FEATURES.md @@ -59,20 +59,20 @@ e5e50be31b3160588599336b1871b07a1e829b202454a67d2dc4e2e754d23eab docs/LOGS.md 48105c4303401aa99ffff00d3ebaf3024535a492a4a7b883c6803e4732b37434 docs/MONITORING.md 6d3937088eeb67a9f690d44ebe0b6e660b68116dbf69091ac7816bdc52cec2b6 docs/PERFORMANCE.md 96a69bf9b68e72e6f352f23173bcd0b013af8d6d9cef56141e49efbe35f68f2d docs/PHP_FPM.md -b0c97a728d4c2d372e483d14bd8383bec17869e634cc0123f7919c1e56b7ac91 docs/POLICY.md +add07f23324742fb03fe5f77fb671bb239f6220f8e11c9270e0ec459ea3a256f docs/POLICY.md 54e9e771707777144105a59c4d6dd6589cc74d735aea660af5366283cf820ee6 docs/README.md e90842a75459ddb5892334f66a4139d9301280b4d0c17077d211749bd7c90d80 docs/RESPONSE_DELIVERY.md 95ab4786792d5920a2e109b7d196838057f24b512a69d713fb5884dc75c84339 docs/SCREENSHOTS.md 3a48184b36d225757fc5e2d22c629f89bfe5d4007ff087f0be0ce02a5fb04c28 docs/SECURITY.md -a1f69782b08d395a9672250eaac4595ffb1465b66a7a62901781a01a9030c6a0 docs/STREAMS.md +adc43ad1ea4f1f9a9726c0bf1ec529a4a5cc9ee39e4013c945f807d31555a352 docs/STREAMS.md c9c9a0b401f0565f15b834d855bfdb34edb3eab46bff03d9e0825af204d20bf8 docs/TODO.md c4407cbd70d181e87f64e8d1736624d7b8b59a04b915ad3464f0e1f16d474e99 docs/TRANSPORT.md df83d07d7186a5eea60d206dee3cb62b7f6505a066d84141fc53130e2f29760b docs/TROUBLESHOOTING.md 53005e1eeb460c960794e2b2f1ab7cfc472c510b14bea3193d25f5f81ba7a1e4 docs/VCL.md 4a5534b628c18f4e83c67c6136b60969c884391fbe55cc6bd4f2354711d8ffb7 docs/VCL_SUPPORT_MATRIX.md 382e084a1f9e35627ccb43eaf451c18fb6d0cc752397c2178108d71de592a931 docs/VCL_TRAFFIC_COOKBOOK.md -657720a2b093ba8c08c2bf2c01b02a0f95fd3c67751868d1d1cc1dbf31b633e5 docs/VHOSTS.md -e989bb6e00b9d92a92f4e5c8bfd19a1117b40f684f35ee8ae731857df1b57ba3 docs/WEB_SERVER.md +19ac53f4f908f7761ed77f1241d809b26527fd74770714c4c799539351f05259 docs/VHOSTS.md +0e4b6fd1a73187f1660c98b0b817fbd913989211044eee18f5afa0acfae53a39 docs/WEB_SERVER.md 42822b1c9801bcadb0e2d785cb91883ca2df1da141222631f153030c95f5e197 docs/images/about.png deff2393a987ac7102179dc85b48baf2c4a3882291bb8c7c584d760cc497c631 docs/images/api.png 74df8228ea6283004b3e87b4d297e43637371eb4a700b69c7248114c8670777a docs/images/cache.png @@ -123,7 +123,7 @@ d242de9614fbb52933b4accd32f4715ca94107abe4a3b1d7e088362b07a6ba60 examples/vhost af2bdb1343a8141069e94ccd2c7f92574ad848437e2f9fdb5c7576a9a18ef4a5 examples/vhosts-private.json 716dd2ba150e3813116d2a8c568865b1e315f2fd29c6e636dcd72709dd444837 grafana/README.md 0354f8b8e78e81dd8d240e0170fee14202e94686831f1a008fdc2a58da528de4 grafana/rustproxy-overview.json -1a041c505669625a7f0f8011484cf5b6d2ec69a7de859801312e4fcf4c8d3555 install-debian13.sh +36a321ff1c1ec593fefb45f843760e990de629d5db0f27d68693192ee180380b install-debian13.sh 909e9ab94617ace74a425f15084bf85f3086cc52ba5b28f2b441ff800abc6ef9 install.sh 42f9f1d18c021fc7734b5bd020844bf678725a0e539e2fcbe05ec676f6239eae integrations/README.md 13482032666464b2583016144ddc98b036281b2253c8fd8bcbad28cb0ed53876 integrations/opnsense-acme/README.md @@ -138,8 +138,8 @@ e9cbb0224c4a3d23a6019ba557e0cd568c1ad5e1582ff1e335fb7d99b7a1055d integrations/r 3f092a9ab80221eddd67be4d1a776acbc6e04c1eb6011b588280c28e83b2582f integrations/routeros-oci-build/build-routeros-oci.sh 3f267cafa16006e5456ade78ee2d5fae02cc7ce747839523068ffd8d7c98798a integrations/routeros-oci-build/docker-entrypoint.sh ae2ee2887fcba096d0de25edcc18faa1ffec35759274518db1bf6d6982f7176c langs/README.md -44f13c8577f0c2a6798d3b977f41291800446b2b0ddecde5e8e5974bc4fcc9d9 langs/en_US.json -427774933ff725ca6a6568ddf42a615793e4e72a2c2de5e2655b66d5b308fed1 langs/pl_pl.json +13bdb323e2e7403aeda490971ec396fc56e0c2e2d8b070c9a5221d1cf9817530 langs/en_US.json +2d59a512293cc21d478dffcb1c1aa8dc69aa6375f7915df5d6d1915dd78414d9 langs/pl_pl.json 38773ed251a8c24af353f4744e498ae2bc7d4151df7927e942c4ac223f6008e1 make_zip.py e830d37dd1f81a4b0aa7d535f5bba69e34e433b0fd99cc8ee0b296786c32379a migrations/0002_admin.sql 20112cc82192098b8d602f1c4f7ca08712e9e1366c845fabb92753187c370d35 migrations/0003_certificate_renewals.sql @@ -213,8 +213,8 @@ f9b2c8fe62cc92d7693e46145b2543b12dd6d4943fe2d52c67ed6958d4af83de src/admin/docu e2253599b5e39510946729920d240711403a3889cc495eb49824296228f1d080 src/admin/file_logs_query.rs 1594c8666991c1d07487a6a718211ef404cf49114721960f7e119bb7f605e3d2 src/admin/logging_api.rs 781fd5f176dd8f2372f75bd90edcf160708e2d0a8d6a115ba4b283c0cd49eb2d src/admin/mod.rs -10e2b373b117fa40d8b42bcb055a9c8bd26e6d3ac24e70dab9c44fa96f16e01a src/admin/openapi.json -9f8842cdec27d703d1795dd6eb37d9420e9f5a2e56a0df93278c92bace5d1f4c src/admin/operations.rs +123d6aa161c8c04874e396ae5ce63b1bfc0b1b0929ddc3d912eba8eed7fea5cc src/admin/openapi.json +f34628487f99bc37946b2da7d77a9858bf2f40a7b36250e3da5a742d7834f347 src/admin/operations.rs 257d93a29d0bda96462bcf695aba8d0ec0f9412c379e066ec46ae8ee034e3a53 src/admin/panel_assets.rs f5127855c2994d052678865df36d703b74f4a0afc633daf7718b10da18d26e37 src/admin/panel_content.rs a051fb9f67d4d9dac1c05327006639b3dfcd7d25172e48f457bb2724c1ead9ba src/admin/policy.rs @@ -225,15 +225,15 @@ ea202c67d9acb7614046f153beecdff10d5822b3d5627eaf2ebda33954b36474 src/admin/pref 62ecbae5dee00aeeca3eb806e2605372471dfab971cde8f66f11e711df8fcea1 src/admin/public/mod.rs 7a00e4ab943f74d2b1bdcbfab7f9cd3f584e9f59536b4aca6c4c31f5f5508d12 src/admin/public/tests.rs 6930b4f4b45257772b321b20a9becdf9bc4610274852948ba38c2d0cdf02dfaf src/admin/refresh_preferences.rs -fb612856189d447f6f2dc88b5a854e51db7f06c518bba4a1432ec6f0d0f9c4f5 src/admin/router.rs -fba52102e77ca8871a42f97c91be8f10a9aa4f997868652d550fff3fbd41b66e src/admin/session.rs +409fc0bfa0b35b766e50c63b2e147d439fa31f89f4559df9d7045a903a2da7c0 src/admin/router.rs +0c5efa4669b5827e352f946edcc81de8fb18fa34ba3d458d314f018e673008d9 src/admin/session.rs 38f53c52c2e3bc49b5ad4254c657d282cf4ca7c8c11c6a79cc1d7a2086f017de src/admin/status.rs bac2116e9a7d5f19a112565e1483787ff6102f489bed0cb3b0b3e2102ddd3edb src/admin/status_live.rs c20f214e2ec2a14d8a88d07a63a27d9396a7a6bf9446f6ee31dbd77b12e4b585 src/admin/status_system.rs ea1d0b8ff69157215f9358f0de35b91462ab2bf1fb97f9ce9b37846d0432c56b src/admin/tail.rs -6c72807e230f3df2d7c72f25f840e2f0accdf95371d9c4d63f9a49c1a7a35876 src/admin/tests.rs +fbe931102341a612c1b295fefb7672230fc9746e37453fe2db3a9244b57088b5 src/admin/tests.rs d6c7ef48325c8f4f7ae7504827c0255c263b41c838f61960381907ca78eb9b95 src/admin/web/acl-picker.js -1e46ac359a11a85374d93936fb849864bea43021c20770fff5076acd846e8859 src/admin/web/acme.js +dd43c3ec62112f296760b45a549956441d9b8dcb9de43767012067d996d50368 src/admin/web/acme.js 30a71c399e9a2cd9a4c1830568e4767f219ce09bca35f6d5fd22424f1a6617ac src/admin/web/admin_origin_rejected.html aa33315bf8e11d281778cdf258444ad8f02c22ac4fb8fba02fd4ee8677595d1f src/admin/web/api-tokens.js c7699bd6a78a1b76739999a363b78cea9cca7401dd993b2e278427ffb8b3f4f7 src/admin/web/app/alerts.js @@ -241,7 +241,7 @@ faa9735c2a02746b2954bc4955eb609f94afebb685cd5521d2629640cea2777a src/admin/web/ aed3aea4eef0011c6b51d39736782e7d1ec52662e422f40e0c7b9ddfc19d0378 src/admin/web/app/certificate-inspection.js 86240b836ba68b1c203701f893c76a606434e094a203b76b91287c9a23853f9b src/admin/web/app/chart-scales.js dedda129e173a347ebca9445c8a313849d1d678c256deabeb18f9977559e021a src/admin/web/app/config-history.js -112498688da2641cc44c1205c303ea08e20919cf61365db34c2988a1b8eee565 src/admin/web/app/core.js +3f85d490a2d175045bab7d343175ab14fccf24384de772195e23fd58cac5b6d5 src/admin/web/app/core.js 1fe90b27e241477e67b24283f3ae8a15a1770e3a3a8f5017a0732396294bff90 src/admin/web/app/dashboard-inline-layout.js e9830fdbaaf0a671f7ce2121564cfd7960c49733b172a4bd927f15d0e722fc4d src/admin/web/app/dashboard-presets.js fce1fe268749b28ab68ac41519ced05252c1193f11bc9a3851de45dae4c419ad src/admin/web/app/docker-dashboard.js @@ -259,7 +259,7 @@ e3b9202fa113f39453c699c3595ab006b120dd759c342c078660d85c77e4c2df src/admin/web/ 3b8e566d81a5b94ef21c73e7805ae128454f085554de9358040de266bcbdb0e0 src/admin/web/app/refresh.js 66de066418464669f9d47c6f61b0333b13b95e188a90bb964c7851acb3bc3cbf src/admin/web/app/runtime.js 31201586925e6f4792071d7d03fb05dcc4a69a03c02a4e85eb0746f45af68074 src/admin/web/app/session-resume.js -7870ccf4d8868c7f72328d2144dfed3c855e62d9b4649b9ec87045afef3e3794 src/admin/web/app/settings.js +c638e82ebe2c49c61124ab647e74ff594d293fa85131051cff625f9d1f1451a5 src/admin/web/app/settings.js 2281f06990f86acd3ff12fa368e1b73e4c83601e20245f24abbce389dfccb77f src/admin/web/app/sidebar.js b7ead49224a4ec67181d3f24f9d9634bd6d76756f826a4d5d993300637d1d8f3 src/admin/web/app/stream-dashboard.js 7de070cc8cdde45d7e0932259299e341e25b32c9ffbd87e4fcce934d0f090de4 src/admin/web/app/web-overview.js @@ -282,22 +282,22 @@ eba1fb0a0bdce0fb6a8884c3fa446f2098b1fdeccb59da47b1c160899b986b0e src/admin/web/ e9cfe14e8e5093e8f8be504d9590643d71935846241f4e73ea4afcafb7f0f806 src/admin/web/cf_page/error_504.html 9efc37b434336db30333f28c09e14355c45332e1d28c64bb6b88f875ba9fd297 src/admin/web/cf_page/placeholder.html 38bb67d9ec6b6e08298d63267afa3a92cbc0818fb0a21fc39520afdca4a995e4 src/admin/web/cf_page/welcome.html -c2912a5e218896177776d4c5920e240092a3de66f9a4b95c1631796771e0ce3c src/admin/web/css/00-tokens.css -90a03a0ec649801837a85b2cc3dfa2eb3b4b504c25a8f96e4fa3278afb84bbb3 src/admin/web/css/10-base.css +5ad913eb4a06e9da62338da4e6122d4bfef93954b8ee718215d3e00ad1e5ab17 src/admin/web/css/00-tokens.css +e44d19066b1c9dc470c74c5a40d590e6f00acf6a74e4eb6d7e092ab72bee7c20 src/admin/web/css/10-base.css 9cd9b62ff8cfba47cb180e29ea5f69b8e97c7817dfcfddcb55fc4e08d11a7184 src/admin/web/css/20-shell.css -fa12ba689dd8002c3a8bf2b4d05de210ea2b6793d90d9e318da9ebfa07dace65 src/admin/web/css/30-overview.css -f9ce91bfceabfbccd9ddfb333b529895a4aed864355e916e7ecfb5b5839317a5 src/admin/web/css/40-editors.css -5029fad7af88e1d4bc3f72cc66c0899c47c4269d51637e12e4efe2c1a8310841 src/admin/web/css/50-settings.css -fbaca765920866bb77280d3d762a81ffdd4e730869d87c3e653b2d298b39ef89 src/admin/web/css/55-policy.css +d26c13fdc10f94aa630e7ae059b68b1931341c026d231e7245d0d32c42451ad0 src/admin/web/css/30-overview.css +59f08fa609b266df6558cebf41b5b1d27d881dc4449f946b3ae35a8559e79593 src/admin/web/css/40-editors.css +587f026c6dbc8c3dd116314c468fee68a5c1a0342ca37950973771d4367796bb src/admin/web/css/50-settings.css +5cff4e76562d3f8dd4789830f7af2e5d81f6f7d019b0e748310a1baa39aa51ba src/admin/web/css/55-policy.css 7691a9608e376bcc1f0802edef8b19e5c5ecb522e560a2fa7168a14985eb561a src/admin/web/css/60-monitoring.css -9e0836087aba67d7493d515a54435234785416adb730b40881afafff80739302 src/admin/web/css/70-responsive.css +85ec6c754a260f817ad8130a517e1da965704654f6a930bd62e87a56898d6b37 src/admin/web/css/70-responsive.css 4149881632a6ed48340443c51362c59d2ac7ae16eba8d724fa9a9555d2af8314 src/admin/web/css/README.md ea08fbe1a616042f2dab32d829dba837660a5facb068bb9d5a9b3abdb5c00717 src/admin/web/css/manifest.json 7d3c09f13e3026e3230f35472a9d163b790c7c68b672127ed9fb0e66b26e3d70 src/admin/web/dashboard-builtin-presets.json 78bf6179f769b68d518028464697e50dea5d75e33ecb1b89d88e2c2b01e86bf2 src/admin/web/dashboard-defaults.json 355046ecb80ce6adb73ceabd29825b0cf79ca364771070cedd5eb44760fae890 src/admin/web/dashboard-widgets.json 50d1ebcbaf4d0b2968da23bb943fc3f67131c5d32df3f61d23ff37aad9da5b81 src/admin/web/demo.html -95da56f5fa86b9f973de4cc47001196a674ec8947d8811f2c9b0bd90f9e416ec src/admin/web/docker.js +e9c467a632daae1ef71ba2adf67399e80b28a6e61639ea2172b9dcc08e97abe7 src/admin/web/docker.js 8bf5d1f4f06d6e87536d808a680bf3d3a0c90c1637df0e58da667fd22ad4782d src/admin/web/docs.css aeffd403fa1823df7d9fa4c48280b4033b2d15e4cb9f66608caff89290de0a52 src/admin/web/docs.html 306db8db9e4d651a85e09dbc15464e7f920d7fe5bd9ec9d1d8068321eb0106ab src/admin/web/docs.js @@ -317,38 +317,38 @@ e6c4d91d1542d0a5b47bb8736f9539d43a6713df5a473b635519d5b7eac2eb9c src/admin/web/ 003d382cc8dd69ad7237679632c04a9389366bb71dd7dca8ee64ee06614aa9a5 src/admin/web/error_auth_provider.html 0a5fff35555153f59d4346933030a67b6e1a8768cee7a47cfa2fcf1a2c564f63 src/admin/web/favicon.svg 3fbd758d96701dab907e98331b41e8e8953bc969a00aa9e44df5c401b8ac19c9 src/admin/web/file-logs.js -9a243e651984cf0b84649c89ed0452d4961f5384c00909403fc640768ed3feef src/admin/web/host404.js -a066fc38de115ac5b9c76cee73a14f47b9df43370a45c9cf8fec8f2bda8cbb60 src/admin/web/index.html -be9999a001c59630963d60539e860b59999dcf74c5ff0087b12a6fb69b4e7bd2 src/admin/web/integrations.js +1a74b58d355c7e653aa73c524cbbdf3946ba755af45c57a1c2fcb7431ef9fc13 src/admin/web/host404.js +d2689d200b7bf7f322929e0fa3241ac74b962ce4701ffafc3f02a2f2af162104 src/admin/web/index.html +d6ad10900bd4804285b07f188cd232288ca97429a9ed1ce4fafc966beae295f3 src/admin/web/integrations.js 7a12f020fc587205694978ab41b660e9a80487d413fbf6e34fc525eabc58308f src/admin/web/login-keys.json ac9f667273918e18406df06cb2613c923f50a88897693a03a18f500e22dc6ec2 src/admin/web/login.html c2e5f554810b8e34fb47361fb90a01073a2e332ee26d82e030956fad3ec1f83e src/admin/web/login.js -719c7cc6f718a376cf390c58d7d493c6fa0b4126b8f727e9eab823f8609cdb6a src/admin/web/management.js -1f3d10e389c9c20e6eb019509fa6e82b50c6b43bbf988c1210a4d42bb73985d0 src/admin/web/partials/overview-charts.html +faf06be0236fe0a1f145ca20d8c4ad99a901d751ce94ab0366378b954ab9bbff src/admin/web/management.js +d4db7b20fa80d4472e260a99aa18c7beb179a4d9d6b63a9df7d3560168e8c7ee src/admin/web/partials/overview-charts.html bd94e61e051a6bebe0afbda0a21aa36349c2067516b974986765555ed47455cc src/admin/web/partials/overview-metrics.html 8bb503677f51362dc3cc9522596affa65c5960ab5e44b1c935cb4abf85505429 src/admin/web/policy-presets.js 943121aaaaddcee81ce70fb153820666d06a41abab17d60c20c7e3dba1894f8c src/admin/web/policy.js 80d6eb03f204a90f7b140c5b053d0fd8facb350b1c96b74fa1402e2a35d4fb10 src/admin/web/prometheus-token.js -bb16f579d1de89c565c95adb496def4051553f17d928d2128f4bf08ca66e5ca1 src/admin/web/redirects.js -a68bc028c6b12a8c02ab097c49cfba57cf596da4a995d04d89dbd56980656958 src/admin/web/settings.js +c2f7b760577df6d1aaa00478c214766df26162eaf22068f8bb851ebc22581b02 src/admin/web/redirects.js +1f1cbda4f9311ab981814b39e3b18eda4809879f36cf13ae4af9549590813458 src/admin/web/settings.js 8eadbada619b15087783dcfa0e889a81f88e78034d084c5ab616f7912b835940 src/admin/web/status_200.html -6322e589c449eee6db9c3499bb5643d6261f5fc3a5d730cff12cef70d5699fa2 src/admin/web/streams.js +2fe6f16036bd066ddce8c5508bf0209e3f77217211b046215ddb2e0b0c82dca1 src/admin/web/streams.js 14ef42dec556c5fa62ff4ed4d6865d28f322e8e963dc43e3a714ef9d0af12ac6 src/admin/web/system-info.js -12db5600c14cadbbbe7676b170b058e9695108d2661d9cd6b61fe91d355ac731 src/admin/web/tls-configurator.js +7ea8409fa899398ef3d35402d73de6fdf05cf9f28892a5e30fe3f15fc6bb9d7d src/admin/web/tls-configurator.js 336cc5b2a3e5e2514b6b15eed5f2b1ba714458d0e3e913d6f9ad7c870623c758 src/admin/web/traffic-panel.js 675ea169d4cc55fda5e291af536338b882bede1eaa6c9d5cc7dfde0779c7c4d1 src/admin/web/transform-panel.js c30373b0f2dc5672f88bc6fad0ffd5f6d85496d75da8fae83c6aa306e4e0f676 src/admin/web/vhosts/balancing.js -7ef75bee12e36ed981e585eb9dec21fdf438600b4ac5b00ebc9ea4ec62440810 src/admin/web/vhosts/core.js -b73051f1ecfecac3ccd4283e8c703983c0ab7c2c1868026b26d046c6859ae485 src/admin/web/vhosts/editor.js +2146feb7b1dbf5f1923fca85c6624a30fd32cd7322794641255dd29c6ed36e8c src/admin/web/vhosts/core.js +7f3d6a2c93c9d546cf9f712c9038ceb159368bc99ad19be2405232200de7205c src/admin/web/vhosts/editor.js f082588c35d981fc689542d4c12a7614638279335220d587fdee5d3fff822e80 src/admin/web/vhosts/headers-tab.js 3776f72d7051af86ac5fbdd4581040dd88a424c0c6cde789301b032b159094d8 src/admin/web/vhosts/health.js b3239e67901f1796d7a974ade0796f2e3590ff8064628a5629b78c7f6ce2f32e src/admin/web/vhosts/protocol.js 8c3da49973c62333559b0e3588c02beb0b425c025eac5cfa82a1bb968f70d9dd src/admin/web/vhosts/rates.js -3159bfe7edafe11ed6dfa5411cac80f99520fc1cd25e88c3132bce5c172befd9 src/admin/web/vhosts/render.js +d1dc4c4771c2f7d049dc06953e3103aebe47533407ae0b8a1f831176fc3e5fe6 src/admin/web/vhosts/render.js 90684f1bfb0e079438654e1f8c5b9ee1b4f74e49126a82c88768f3ae209a1875 src/admin/web/vhosts/routing.js 7be5a5fed5480b431d2eece59271c2567dd48592b9d7e65fdb30b4a28f58ce3a src/admin/web/vhosts/source.js -a6b50bd62b0396df7b0701b39dd362a9f5402bce8b7acca8fecb5b17fbce009e src/admin/web/web-server-profiles.js -31cc5bc08cb1d34cfbed206277eeed0f4dd09333de0ff0537bd67b404f1184de src/admin/web/web-server.js +2dad90ef4c717508790d16ecc429edf5fd37fc7b2a952f7b47874795cc656dcf src/admin/web/web-server-profiles.js +8cc2751710546ee0e2551d3f3bde33d47891c73f9c1328b8367dd62827387e8f src/admin/web/web-server.js 36f11beed56711640bb56bb6f452bf76dec2ce4be6a57e8abc19560af477c870 src/alerts.rs 2d40c2cb32d7365df0c9cd6c8cb6f0483c7a799786c648f4836a0d9740c6c5ef src/auth/files/mod.rs b2f948bcc3dbd24952c7b1b02d41d06757f49f0c38a78caf51f8f8a687d8480d src/auth/files/tests.rs diff --git a/docs/API.md b/docs/API.md index ea24eaf..1fc4ead 100644 --- a/docs/API.md +++ b/docs/API.md @@ -29,6 +29,7 @@ The current bundled `src/admin/openapi.json` declares these operations (among ot | `GET /api/logs` · `GET /api/live-logs` | Recent and streaming request logs. | | `GET /api/file-logs` · `GET /api/file-logs/query` | Stored-log exploration. Source metadata includes `domains` (current configured hostnames/aliases, empty when not applicable); source and group IDs remain stable. | | `GET /api/traffic` · `GET /api/system-info` | Traffic and system observations. Traffic supports the lightweight `view=live` polling view. | +| `GET /api/pages/preview?kind=&status=&host=` | Panel session only. Renders a local page (`welcome`, `builtin`, `cloudflare`, `cloudflare_welcome`, `cloudflare_placeholder`, `empty`, or `html`, which shows saved custom HTML: `host=<404 host ID>`, or `slot=direct_ip|unknown_host|response|fallback|error-` with optional `vhost=` for per-vhost pages) with a `sandbox` Content-Security-Policy: no scripts, opaque origin, framing only by the panel. | | `GET /api/metrics/json` · `GET /api/metrics/summary` | Full JSON snapshot (includes all Prometheus samples and `summary`) or compact computed `summary` only, both pull-only. [Monitoring](MONITORING.md). | | `GET /api/docker` · `POST /api/docker/refresh` | Docker-agent observation and refresh. | | `GET /api/certificates` · `POST /api/certificates/upload` | Certificate inventory/import. | diff --git a/docs/DOCKER_DISCOVERY.md b/docs/DOCKER_DISCOVERY.md index f2cc490..67d9de3 100644 --- a/docs/DOCKER_DISCOVERY.md +++ b/docs/DOCKER_DISCOVERY.md @@ -46,7 +46,7 @@ Go 1.22+ is required only for the manual build, not for a DEB/RPM installation. 1. Allow port `9876` **only from the RustProxy server** in the Docker-host firewall. The default example listens on `0.0.0.0:9876`. 2. On the Docker host run `sudo rustproxy-docker-agent provision-code` (agent 0.37.0+). It prints one `RPDA1-…` code with the HTTPS endpoint, the Bearer token and the certificate SHA-256 fingerprint. The code **contains the secret token**; paste it only into the panel. Use `--endpoint-host` to put a different host/IP in the code. -3. In **Settings → Docker agents** press **Paste provisioning code** (or open **Provisioning code** in an existing agent to update a rotated token) and paste it. The panel fills in the name, the agent ID (generated from the name like Vhost IDs, editable until saved), endpoint, token and fingerprint. Older agents: enter endpoint, token and fingerprint manually. +3. In **Settings → Docker agents** press **Paste provisioning code** (or open **Provisioning code** in an existing agent to update a rotated token) and paste it. The panel fills in the name, the agent ID (generated from the name like Vhost IDs, editable until saved), endpoint, token and fingerprint. Older agents: enter endpoint, token and fingerprint manually. Each agent is a collapsible row (state, name and ID, endpoint, transport security, connection status, Enabled); expanded it holds the provisioning code, diagnostics and the sections **Connection**, **Authentication & TLS**, **Domains & certificates** and **Default publishing**, plus **Test connection** and **Remove**. 4. Assign **Domains** (at least one; the first, marked ★, is the master domain for new Docker vhosts — click ★ on another domain to make it the master), choose **Certificates** (*Automatic* or a list of certificates), the listener IDs and optional ACL profiles and **Default backend IP**, then save. 5. Use **Docker vhosts → Refresh agents** and check that discovery succeeds before publishing. @@ -156,7 +156,8 @@ In **Docker vhosts**, select the service and set: | **Force HTTPS / WebSockets** | Enable only when needed and when the right frontend listeners exist. | | **Cache / compression / transforms** | Optional; obey the global limits and privacy policy of the application. With **Cache** enabled, **Cache for this vhost** sets a default TTL (empty = global default) and the same cache rules editor as an ordinary vhost (templates, VCL import/preview, compact two-section tester, *Ignore global cache rules*). **Cache & VCL guide** opens the shared modal and inserts examples into this Docker vhost's importer, never the global editor. Tests use unsaved service rules plus saved applicable global rules, unless ignored; a path-only test uses the current service hostname as `Host` when no explicit Host is provided. Unpublished service tests may lack saved vhost settings; see [Cache rules](CACHE.md#cache-rules-vcl-style). Stored as `cache_default_ttl_seconds`, `cache_rules` and `cache_ignore_global_rules` on the assignment. | **Security and access** | Everything an internet-facing app usually needs, without creating an ordinary vhost: **HTTP Basic Auth** (see below), **HTTP methods** (allow only / block listed, the same method picker as vhosts), **per-client IP rate limit** (requests per window and burst; exceeded requests get `429`), **country access** (block or allow only listed countries via GeoIP; country rules of ACL profiles also apply), **security headers** (HSTS with max-age and includeSubDomains, `X-Content-Type-Options: nosniff`, `X-Frame-Options`, `Referrer-Policy`) and **Use verified Cloudflare client IP** when the app is behind Cloudflare. The summary line of the section shows what is active. Stored as `method_policy`, `rate_limit`, `security_headers` and `cloudflare_client_ip`; unused options are not stored. Docker apps have no login of their own; to require one, publish the app through an ordinary vhost with HTTP Basic Auth, forward auth or OIDC. | -| **Headers** | Diagnostic headers — `Server-Timing`, the selected backend (`X-RustProxy-Backend`) and the backend time (`X-RustProxy-Backend-Time`), for testing; keep them off in production. The collapsed **HTTP policies** editor inside this section holds the assignment's policy rules (see [HTTP policies](POLICY.md)); the section summary shows the enabled headers and the rule count. For Docker publications the backend header uses `/<12-character-service-hash>` (for example `node1/012345abcdef`), rather than the internal `docker-node1-012345abcdef/docker` identifier. Ordinary Vhosts retain their usual backend IDs; the change affects only header presentation, not routing, logs or metrics. Stored as `timing_headers`, `backend_header`, `backend_timing_header`. | +| **Diagnostic headers** | `Server-Timing`, the selected backend (`X-RustProxy-Backend`) and the backend time (`X-RustProxy-Backend-Time`), for testing; keep them off in production. For Docker publications the backend header uses `/<12-character-service-hash>` (for example `node1/012345abcdef`), rather than the internal `docker-node1-012345abcdef/docker` identifier. Ordinary Vhosts retain their usual backend IDs; the change affects only header presentation, not routing, logs or metrics. Stored as `timing_headers`, `backend_header`, `backend_timing_header`. | +| **HTTP policies** | The assignment's ordered policy rules (see [HTTP policies](POLICY.md)); the summary shows the rule count. | | **Health / ACL / timeouts** | **Access control** shows the agent default ACL profiles pre-selected (*Agent default in use: …*). Unchecking or changing them overrides the default for this service only; leaving them as they are keeps following the agent default. **Public vhost (no agent default ACL)** publishes the service without the agent default profiles (`inherit_acl_profiles: false`) and disables the per-app ACL; global block/allow rules still apply. Up to eight reusable ACL profiles per app; selected profiles appear as removable badges and the summary line shows the effective state. Optional inline ACL remains independently enforced. Explicit denies and country blocks beat merged allows. Test allowed and blocked clients. | ### HTTP Basic Auth for Docker apps diff --git a/docs/POLICY.md b/docs/POLICY.md index 6240340..c020b8f 100644 --- a/docs/POLICY.md +++ b/docs/POLICY.md @@ -17,7 +17,7 @@ below. VCL remains the owner of its existing cache-rule precedence and terminal - In the panel, open **Settings → Rules & headers → HTTP policies** globally, **Vhost → Headers → HTTP policies**, the location's **HTTP policies** section, - or **Docker Vhosts → service → Headers → HTTP policies** for a Docker assignment. The shared editor offers a rule + or **Docker Vhosts → service → HTTP policies** for a Docker assignment. The shared editor offers a rule builder, scenario presets, a JSON view, import preview and a draft tester. Global settings use the same editor at `settings?tab=policies`. Reordering uses the visible rule order; switching views preserves the same policy object. diff --git a/docs/STREAMS.md b/docs/STREAMS.md index b9a6c87..cecee7b 100644 --- a/docs/STREAMS.md +++ b/docs/STREAMS.md @@ -12,7 +12,7 @@ The **Streams** workspace forwards non-HTTP TCP or UDP traffic through dedicated The source model supports a legacy single-upstream configuration or a backend list (up to the validated per-host limit), with pool-based load balancing and health observations. Do not assume HTTP health-check response codes can be applied to a UDP-only application: use the probe options actually supported by the Stream type. -The backend editor groups connection/capacity settings separately from active health-check options. When **Health checks** is Off, probe tuning fields are hidden; selecting TCP connect/UDP probe reveals them without erasing their values. Hidden fields are excluded from browser validation. +The stream editor has the tabs **Details**, **Listener & upstream**, **Backends**, **Health** and **Limits**. Backends are rows of a table (state, name, weight, address, live health and sessions, chips for drain, session limit, health check and detail metrics); an expanded row holds the connection and capacity fields and can be copied or removed. The **Health** tab holds the health check of every backend. The stream card shows the state (running, pending restart, disabled), protocol, health summary, limits and per-backend health. The backend editor groups connection/capacity settings separately from active health-check options. When **Health checks** is Off, probe tuning fields are hidden; selecting TCP connect/UDP probe reveals them without erasing their values. Hidden fields are excluded from browser validation. ## Behavior and boundaries diff --git a/docs/VHOSTS.md b/docs/VHOSTS.md index 565039f..b10b085 100644 --- a/docs/VHOSTS.md +++ b/docs/VHOSTS.md @@ -92,7 +92,7 @@ Backend pools support scheduling/weighting, standby members, draining and option - `backup` members act as fallbacks; `drain` prevents new normal selection while letting existing work complete within normal lifetimes. Explicitly pinned backends need careful policy review. - Concurrency and queue limits protect overloaded origins. Retries are restricted; do not assume non-idempotent requests are automatically replayed. -The **Redirects** and **404 hosts** editors distinguish host identity/domains from frontend listeners and certificate selection. The configuration options have not changed. +The **Redirects** and **404 hosts** editors have three tabs: **Details** (name, ID, enabled, hostnames), **Frontend** (listeners, certificate, HTTP/2 and HTTP/3) and **Rules** or **Response**. Redirect rules are rows of a rule table: the collapsed row shows match, path, status and target; an expanded rule is split into **When** (ID, incoming scheme, match, source path) and **Where** (target type as URL / host / path on the same host, scheme, path and query handling, status, cache max-age). **Add rule** offers starting points (whole host → new domain, HTTP → HTTPS, one path → URL, directory → another host, empty rule). The URL tester under the rules evaluates the unsaved rules with the same longest-prefix order and `Location` construction as the proxy. The 404 host **Response** tab chooses the page with cards, offers the Cloudflare variant and status, and shows a sandboxed preview (also **Open in a new tab**); custom HTML is previewed from the saved version. Cards in both lists can be enabled or disabled directly. The configuration options have not changed. ## Hostnames, redirects and errors diff --git a/docs/WEB_SERVER.md b/docs/WEB_SERVER.md index 812d82d..062a105 100644 --- a/docs/WEB_SERVER.md +++ b/docs/WEB_SERVER.md @@ -83,7 +83,11 @@ For common Apache 2.2 migrations, `Order deny,allow`, `Order allow,deny`, `Order ## Admin editor layout -In **Web Server → Edit → Delivery**, static file delivery, dynamic compression and precompressed assets have separate sections. In **PHP-FPM**, profile/endpoint, request options, resource limits and FastCGI/php.ini overrides are grouped. Disabled local controls indicate that PHP is off or a shared profile owns those settings; selection and saved values behave as before. +The service list uses the same cards as Vhosts: usage and backend labels, ID and document root, **Edit / Copy / Delete**, a detail strip (FastCGI backend, index/try_files, .htaccess, delivery, Cache-Control, hardening, used by) and live metrics. **Copy** opens a new service with the same settings and an ID generated from the new name. + +The editor tabs are General, Routing, FastCGI / PHP, .htaccess, Cache & headers, Delivery, MIME and Security. **General** starts with the service type (static files, SPA, PHP application with a framework preset, downloads, custom); choosing a type applies the matching preset to ordinary fields, which stay editable — the document root, ID/name and FastCGI endpoint are not replaced. **FastCGI / PHP** first asks where the settings come from: a **shared FastCGI profile** (a read-only summary with *Edit profile* and *Manage FastCGI profiles*) or **settings of this service** (endpoint, handler, request options, limits and php.ini overrides). In **Delivery**, static file delivery, dynamic compression and precompressed assets have separate sections. + +**FastCGI profiles** list each profile with handler, number of services and endpoint; an expanded profile groups Profile and connection, Timeouts and capacity, Custom FastCGI parameters and PHP-FPM options (php.ini, PHP-FPM only). **Copy** creates a new profile with the same settings. A profile used by a Web Service cannot be deleted. ## FastCGI and error responses diff --git a/install-debian13.sh b/install-debian13.sh index 7788576..28a1f20 100755 --- a/install-debian13.sh +++ b/install-debian13.sh @@ -83,10 +83,25 @@ if [[ -n ${SUDO_USER:-} && ${SUDO_USER} != root ]] && id "${SUDO_USER}" >/dev/nu builder_home=$(getent passwd "$builder" | cut -d: -f6) else builder=rustproxy-build - builder_home=/var/tmp/rustproxy-build + # Not under /var/tmp: Debian 13 ages files there after 30 days + # (systemd-tmpfiles), which removes rarely read files from the builder's + # rustup toolchain and Cargo source cache and breaks later builds with + # errors such as "can't find `example` bin at src/bin/example.rs". + builder_home=/var/lib/rustproxy-build + legacy_builder_home=/var/tmp/rustproxy-build if ! id "$builder" >/dev/null 2>&1; then useradd --create-home --home-dir "$builder_home" --shell /bin/bash "$builder" created_builder=1 + else + current_builder_home=$(getent passwd "$builder" | cut -d: -f6) + if [[ "$current_builder_home" != "$builder_home" ]]; then + echo "Moving the build user's home to $builder_home (a fresh Rust toolchain is installed once)." + install -d -m 0700 -o "$builder" -g "$(id -gn "$builder")" "$builder_home" + usermod -d "$builder_home" "$builder" + if [[ "$current_builder_home" == "$legacy_builder_home" ]]; then + rm -rf -- "$legacy_builder_home" + fi + fi fi fi @@ -199,6 +214,13 @@ if [[ "$ALLOW_REMOTE_ADMIN" != "0" && "$ALLOW_REMOTE_ADMIN" != "1" ]]; then exit 1 fi +# Extracted crate sources are a cache: Cargo re-extracts them from the +# checksum-verified .crate archives, so a damaged or partly removed copy +# (interrupted build, temp-file cleanup) cannot break the build. +if [[ "$builder" == rustproxy-build ]]; then + run_builder rm -rf -- "$builder_home/.cargo/registry/src" "$builder_home/.cargo/git/checkouts" +fi + run_builder env RUSTUP_TOOLCHAIN="$build_toolchain" \ CARGO_BUILD_JOBS="$BUILD_JOBS" \ CARGO_PROFILE_RELEASE_LTO=false \ diff --git a/langs/en_US.json b/langs/en_US.json index eb58fe7..b0f1923 100644 --- a/langs/en_US.json +++ b/langs/en_US.json @@ -892,6 +892,7 @@ "locationAdd": "Add location", "locationHelp": "The longest matching prefix wins. The original path and query are retained. Select a backend from this host or add a dedicated backend. Host authentication and ACL always apply.", "aclUse": "Enable IP access list", + "aclDeny": "Deny", "aclAllow": "Allow", "aclNetwork": "IP/CIDR or DNS name", "aclAction": "Action", @@ -1638,8 +1639,6 @@ "dockerClientIp": "Client IP", "dockerDiagnostics": "Diagnostic headers", "dockerDiagnosticsHelp": "Server-Timing, selected backend and backend time in responses; for testing, off in production", - "dockerHeaders": "Headers", - "dockerHeadersHelp": "Diagnostic response headers and HTTP policy rules", "dockerPolicyRuleCount": "Rules: {count}", "dockerPolicyNone": "No rules", "dockerRefresh": "Refresh agents", @@ -2108,6 +2107,33 @@ "webServiceSearchPlaceholder": "Search name, ID or document root", "webServiceNew": "New Web Service", "webServiceEditor": "Web Service configuration", + "webServiceKindStatic": "Static files", + "webServiceUsed": "In use", + "copySuffix": "copy", + "webServiceCardFastCgi": "FastCGI backend", + "webServiceCardIndex": "Index / try_files", + "webServiceCardWarnings": "warnings", + "webServiceCardDelivery": "Delivery", + "webServiceCardPrecompressed": "precompressed br/gzip", + "webServiceCardRules": "rules", + "webServiceCardAttacks": "attack probes blocked", + "webServiceCardHeaders": "fingerprint headers removed", + "webServiceKindTitle": "Service type", + "webServiceGeneralSection": "General settings", + "phpProfileEdit": "Edit profile", + "webServiceKindStaticHelp": "HTML, images; cache and precompressed files", + "webServiceKindSpaHelp": "unknown paths → index.html", + "webServiceKindPhp": "PHP application", + "webServiceKindPhpHelp": "PHP-FPM with the selected application profile", + "webServiceKindDownloadsHelp": "directory listing and downloads", + "webServiceKindCustomHelp": "no preset; keeps the current settings", + "phpSourceProfile": "Shared FastCGI profile", + "phpSourceProfileHelp": "the same settings in many Web Services", + "phpSourceLocal": "Settings of this service", + "phpSourceLocalHelp": "edit FastCGI / PHP-FPM only here", + "phpProfileUsedCount": "{count} service(s)", + "phpProfileSectionConnection": "Profile and connection", + "phpProfileLabel": "Profile", "webServiceTabGeneral": "General", "webServiceTabRouting": "Routing", "webServiceTabMime": "MIME", @@ -3251,7 +3277,7 @@ "dockerDomainsNone": "No domain assigned", "dockerDomainsRequired": "Assign at least one domain to the agent", "dockerDomainsSearch": "Search or type a new domain", - "dockerDomainsSelected": "{count} domains", + "dockerDomainsSelected": "Domains: {count}", "dockerMasterDomain": "Master domain", "dockerProvisionAdd": "Paste provisioning code", "dockerProvisionApplied": "Filled from the provisioning code: {endpoint}. Review and save.", @@ -4491,6 +4517,179 @@ "webServiceFastCgiHandlerHelp": "Choose a backend protocol responder: PHP-FPM executes PHP, fcgiwrap runs CGI programs, and FastCGI responder connects to any compatible application. Configure separate Web Services and Vhost locations for different roots or endpoints.", "webServiceFastCgiScriptPrefix": "Public SCRIPT_NAME prefix", "webServiceFastCgiScriptPrefixHelp": "When a Vhost location strips a URL mount prefix (for example /app/cgi-bin), set it here. RustProxy prepends it to SCRIPT_NAME but leaves SCRIPT_FILENAME under the document root.", - "pageCloudflareAll": "Switch all to Cloudflare style" + "pageCloudflareAll": "Switch all to Cloudflare style", + "dockerLiveViewHelp": "Refresh this view from RustProxy memory every 5 seconds", + "trafficLegendAria": "Request rate by HTTP protocol and transformed response rate", + "trafficLegendTotal": "Total", + "redirectTabDetails": "Details", + "redirectFrontendTab": "Frontend", + "redirectTestUrl": "Test a URL against the unsaved rules", + "redirectStepWhen": "When — match", + "redirectStepWhere": "Where — target", + "redirectTargetUrlHelp": "fixed address", + "redirectTargetHostHelp": "path from the request", + "redirectTargetPathHelp": "same host", + "redirectChipHttpOnly": "HTTP only", + "redirectChipHttpsOnly": "HTTPS only", + "redirectChipStrip": "strip prefix", + "redirectChipReplace": "fixed path", + "redirectChipNoQuery": "no query", + "redirectChipCache": "cache", + "redirectTplDomain": "Whole host → new domain", + "redirectTplDomainHelp": "Every path to another host, path and query kept (301).", + "redirectTplHttps": "HTTP → HTTPS", + "redirectTplHttpsHelp": "Plain HTTP requests to the HTTPS address of the host you enter (308).", + "redirectTplPage": "One path → URL", + "redirectTplPageHelp": "An exact path to a fixed address (301).", + "redirectTplDirectory": "Directory → another host", + "redirectTplDirectoryHelp": "A path prefix to another host without the prefix (301).", + "redirectTplBlank": "Empty rule", + "redirectTplBlankHelp": "The default rule; fill in every field yourself.", + "redirectTestHint": "Enter a URL or a path (/blog/post?x=1). The result uses the rules in this form, before saving.", + "redirectTestInvalid": "This is not a valid http(s) URL or path.", + "redirectTestOtherHost": "not a source hostname of this redirect; another host handles it.", + "redirectTestNoRule": "No enabled rule matches — the request is handled like an unknown host.", + "redirectDisableConfirm": "Disable this redirect host now? Its hostnames stop redirecting after the save.", + "redirectDisable": "Disable", + "redirectEnable": "Enable", + "redirectRuleOne": "rule", + "redirectRuleMany": "rules", + "redirectRulesEnabled": "enabled", + "redirectRulesDisabled": "disabled", + "redirectStateOn": "Enabled", + "redirectStateOff": "Disabled", + "redirectRuleFew": "rules", + "redirectTargetLabelUrl": "Target URL", + "redirectTargetLabelHost": "Target host[:port]", + "redirectTargetLabelPath": "Target path", + "notfoundResponseTab": "Response", + "notfoundKindWelcomeHelp": "A neutral “nothing here” page.", + "notfoundKindBuiltinHelp": "The built-in error page.", + "notfoundKindCloudflare": "Cloudflare style (offline)", + "notfoundKindCloudflareHelp": "Status page, welcome page or placeholder.", + "notfoundKindEmptyHelp": "No body, only the status.", + "notfoundKindHtmlHelp": "Paste the page markup (no external resources).", + "notfoundCloudflareVariant": "Cloudflare variant", + "notfoundVariantError": "Status page", + "notfoundVariantWelcome": "Welcome page", + "notfoundVariantPlaceholder": "Placeholder", + "notfoundPreview": "Preview", + "notfoundPreviewOpen": "Open in a new tab", + "notfoundPreviewHtmlUnsaved": "Custom HTML is previewed after the first save of this host.", + "notfoundPreviewHtmlSaved": "The preview shows the saved HTML; save to see your changes.", + "notfoundPreviewEmpty": "This response has no body: browsers show their own empty page.", + "notfoundStateOn": "Enabled", + "notfoundStateOff": "Disabled", + "notfoundDisableConfirm": "Disable this 404 host now? Its hostnames are no longer answered by it after the save.", + "streamBackendsTab": "Backends", + "streamHealthTab": "Health", + "streamWeightShort": "weight", + "streamChipDrain": "drain", + "streamChipMax": "max", + "streamChipNoHealth": "no health check", + "streamChipUdpProbe": "UDP probe", + "streamChipMetricsOn": "detail metrics", + "streamChipMetricsOff": "no detail metrics", + "streamBackendCountOne": "backend", + "streamBackendCountFew": "backends", + "streamBackendCountMany": "backends", + "streamLimitConnections": "connections", + "streamConnectShort": "connect", + "streamDisableConfirm": "Disable this stream now? Its listener stops accepting connections after the change is applied.", + "settingsGroupPanel": "Panel", + "settingsGroupNetwork": "Network & input", + "settingsGroupTraffic": "Traffic & responses", + "settingsGroupObservability": "Observability", + "settingsGroupAdministration": "Administration", + "settingsGroupTls": "TLS & certificates", + "dockerAgentSectionConnection": "Connection", + "dockerAgentSectionAuth": "Authentication & TLS", + "dockerAgentSectionDomains": "Domains & certificates", + "dockerAgentSectionPublish": "Default publishing", + "listenerSectionIdentity": "Identity & addresses", + "listenerSectionProtocols": "Protocols", + "pageKindInheritHelp": "no change, built-in behaviour", + "pageDirectIpWhen": "Someone opens the server's IP address instead of a domain (for example a scanner or bot).", + "pageUnknownHostWhen": "DNS points the domain at this server, but no vhost, redirect or 404 host serves it.", + "pageErrorsWhen": "Replaces the body of errors generated by RustProxy and of statuses a vhost intercepts; the status stays unless you choose another one.", + "pageStaticHostWhen": "Every request to this vhost gets this page instead of the backend.", + "pageMissingPathWhen": "A request matches no route of this vhost.", + "pagePreviewInheritDirectIp": "Not set: a request to the IP address is handled like an unknown host.", + "pagePreviewInheritUnknown": "Not set: plain text “RustProxy: no route for this host/path” with status 404.", + "pagePreviewInheritError": "Not set: the error response is sent unchanged (from the backend or a short RustProxy text).", + "pagePreviewInheritVhost": "Not set: the global page from Settings → Default responses is used.", + "pagePreviewHtmlUnsaved": "Custom HTML is previewed after it has been saved.", + "cacheFlowIntro": "How a request travels through the cache. Click a step to open its settings.", + "cacheFlowTitle": "Cache request flow", + "settingsFlowOpenTab": "Open these settings", + "cacheFlowHit": "answered from memory or disk, backend not contacted", + "cacheFlowMiss": "fetched from the backend and stored if cacheable", + "cacheFlowBypass": "rule or bypass prefix skips the cache", + "cacheFlowDisabled": "Cache is disabled globally: every request goes straight to the backend.", + "cacheFlowSieTimeout": "timeout", + "cacheFlowSieConnection": "connection", + "cacheFlowClient": "Client", + "cacheFlowClientLine": "GET / HEAD request", + "cacheFlowRules": "Rules", + "cacheFlowRulesCount": "rules", + "cacheFlowSkipQuery": "?query → bypass", + "cacheFlowKeepQuery": "?query cached separately", + "cacheFlowPrefixes": "bypass prefixes", + "cacheFlowHot": "HOT (RAM)", + "cacheFlowEntries": "entries", + "cacheFlowMaxObject": "max object", + "cacheFlowMaxTtl": "max TTL", + "cacheFlowCold": "COLD (disk)", + "cacheFlowColdLine": "evicted from RAM, kept on disk", + "cacheFlowColdOff": "disabled", + "cacheFlowBackend": "Backend", + "cacheFlowMissLine": "asked only on MISS", + "cacheFlowNoGrace": "no grace", + "cacheFlowNoStale": "no stale-if-error", + "cacheTimelineStored": "Stored", + "cacheTimelineStoredLine": "fresh copy served as HIT", + "cacheTimelineProactiveLine": "of popular entries refreshed in the background", + "cacheTimelineAfterTtl": "TTL expired", + "cacheTimelineGraceLine": "stale copy served while the backend refreshes", + "cacheTimelineNoGraceLine": "next request waits for the backend", + "cacheTimelineBackendDown": "Backend failing", + "transformFlowTitle": "Response transformation flow", + "transformFlowBackend": "Backend", + "transformFlowBackendLine": "response, possibly compressed", + "transformFlowDecode": "Decompress", + "transformFlowDecodeLine": "gzip / deflate / br / zstd → plain", + "transformFlowTransform": "Transform", + "transformFlowNoOps": "no operations enabled", + "transformFlowMaxBody": "up to", + "transformFlowNoTransform": "skips Cache-Control: no-transform", + "transformFlowCache": "Cache", + "transformFlowCacheLine": "stores the smaller result", + "transformFlowEncode": "Compress", + "transformFlowClientLine": "fewer bytes to download", + "transformFlowDisabled": "Transformation is disabled globally: responses pass through unchanged.", + "transformExampleBefore": "Before", + "transformExampleAfter": "After", + "transformJavascriptHelp": "Trims indentation and extra spaces; comments and code stay untouched.", + "transformCssHelp": "Removes comments and whitespace from stylesheets.", + "transformHtmlHelp": "Removes HTML comments (conditional comments and script/style contents are kept).", + "transformSvgHelp": "Removes comments from SVG files (CDATA is kept).", + "transformJsonHelp": "Removes formatting whitespace from JSON.", + "securitySummaryAccount": "Administrator", + "securitySummaryTokens": "API tokens", + "securitySummaryTokensLine": "limited to source addresses", + "securitySummaryPolicies": "Host access policies", + "securitySummaryPoliciesLine": "hosts with their own IP rules", + "securitySummaryNoPolicies": "only route and vhost ACLs restrict access", + "policyDefaultAllowTitle": "Allow by default", + "policyDefaultAllowHelp": "block only the listed deny CIDRs", + "policyDefaultDenyTitle": "Deny by default", + "policyDefaultDenyHelp": "allow only the listed allow CIDRs", + "policySimulatorTitle": "How will it decide? Test client IPs (comma-separated)", + "policySimulatorInvalidIp": "not an IP address", + "policySimulatorMatches": "matches", + "policySimulatorNoMatch": "no matching rule → default", + "policySimulatorDns": "Hostname rules (e.g. office.example.com) are resolved at runtime and are not part of this simulation.", + "policySimulatorAllowed": "ALLOWED", + "transformFlowEncodeLine": "global compression with vhost overrides (zstd / br / gzip / deflate)" } } \ No newline at end of file diff --git a/langs/pl_pl.json b/langs/pl_pl.json index 2d316e9..ff5af39 100644 --- a/langs/pl_pl.json +++ b/langs/pl_pl.json @@ -483,7 +483,7 @@ "vhPassiveFall": "Pasywne błędy przed wyłączeniem (puste = active fall)", "vhPassiveRise": "Pasywne sukcesy przed przywróceniem (puste = active rise)", "vhPassiveWarning": "Włączenie 5xx lub wolnych odpowiedzi może wyłączyć cały backend po serii błędów z pojedynczego endpointu.", - "vhSticky": "Sticky sessions", + "vhSticky": "Sesje sticky (przyklejanie)", "vhStickyMode": "Tryb przypisania", "vhCookie": "Nieprzezroczyste cookie proxy", "vhCookieName": "Nazwa cookie (pusta = domyślna per vhost)", @@ -672,7 +672,7 @@ "diagInherit": "Dziedzicz nagłówki diagnostyczne", "diagRequestId": "Udostępnij X-Request-ID", "hideMockOrigin": "Ukryj X-Mock-Origin", - "diagHelp": "X-Request-ID jest opcjonalny. Pozostale naglowki odpowiedzi upstreamu kontroluj zwyklymi regulami naglowkow odpowiedzi.", + "diagHelp": "X-Request-ID jest opcjonalny. Pozostałe nagłówki odpowiedzi upstreamu kontroluj zwykłymi regułami nagłówków odpowiedzi.", "forwardingSettings": "Tożsamość klienta / forwarding", "forwardingHelp": "Domyślnie nagłówki forwarding od klienta są usuwane. Dodaj tylko kontrolowane proxy. Łańcuch jest sprawdzany od prawej do pierwszego niezaufanego adresu.", "forwardingCanonical": "RustProxy generuje Forwarded, X-Forwarded-For, X-Real-IP, X-Forwarded-Host, X-Forwarded-Proto, X-Forwarded-Port i X-Forwarded-URI. Adres docelowy połączenia nigdy nie pochodzi z nagłówka.", @@ -779,7 +779,7 @@ "acme.invalid_domain": "Podaj prawidłową nazwę DNS (ASCII/punycode).", "acme.dns_names_only": "Certyfikat wymaga nazw DNS, nie adresów IP.", "acme.invalid_environment": "Wybierz staging albo produkcję.", - "acme.tos_required": "ACME: tos required.", + "acme.tos_required": "ACME: wymagana akceptacja regulaminu.", "acme.invalid_dns_server": "Podaj adres IPv4 lub IPv6 serwera aktualizacji DNS.", "acme.invalid_limits": "Port musi mieścić się w 1-65535, a czas propagacji w 10-900 s.", "acme.invalid_key_algorithm": "Dozwolone algorytmy TSIG: HMAC-SHA256, HMAC-SHA384 i HMAC-SHA512.", @@ -829,9 +829,9 @@ "providerHint_existing": "Wskaż pliki, które już istnieją na serwerze RustProxy. Wybierz nazwy plików z /certs albo pełne ścieżki zewnętrzne, np. /etc/letsencrypt/live/example.com/fullchain.pem i privkey.pem. Pliki zewnętrzne nie są kopiowane do backupu RustProxy.", "acmeCfToken": "Token API Cloudflare", "acmeOvhEndpoint": "Region API OVH", - "acmeOvhApplicationKey": "OVH application key", - "acmeOvhApplicationSecret": "OVH application secret", - "acmeOvhConsumerKey": "OVH consumer key", + "acmeOvhApplicationKey": "Klucz aplikacji OVH", + "acmeOvhApplicationSecret": "Sekret aplikacji OVH", + "acmeOvhConsumerKey": "Klucz konsumenta OVH", "acme.invalid_provider": "Nieobsługiwany dostawca certyfikatu.", "acme.invalid_api_credential": "Brak klucza API lub niedozwolone znaki w kluczu.", "acme.invalid_ovh_endpoint": "Wybierz OVH Europa lub Kanada.", @@ -892,6 +892,7 @@ "locationAdd": "Dodaj lokalizację", "locationHelp": "Wygrywa najdłuższy pasujący prefiks. Ścieżka i query pozostają bez zmian. Wybierz backend hosta lub dodaj osobny. Uwierzytelnianie i ACL hosta obowiązują zawsze.", "aclUse": "Włącz listę dostępu IP", + "aclDeny": "Zablokuj", "aclAllow": "Zezwól", "aclNetwork": "Adres IP/CIDR lub nazwa DNS", "aclAction": "Akcja", @@ -1638,8 +1639,6 @@ "dockerClientIp": "Adres IP klienta", "dockerDiagnostics": "Nagłówki diagnostyczne", "dockerDiagnosticsHelp": "Server-Timing, wybrany backend i czas backendu w odpowiedziach; do testów, na produkcji wyłączone", - "dockerHeaders": "Nagłówki", - "dockerHeadersHelp": "Nagłówki diagnostyczne odpowiedzi i reguły HTTP", "dockerPolicyRuleCount": "Reguły: {count}", "dockerPolicyNone": "Brak reguł", "dockerRefresh": "Odśwież agentów", @@ -1780,10 +1779,10 @@ "dockerCompressionHelp": "Włącz lub wyłącz kompresję dla tego vhosta Docker. Dostępne kodeki i ich priorytet wynikają z globalnych ustawień Response.", "dockerCache": "Cache", "vhProxyTimeouts": "Timeouty proxy", - "vhProxyConnectTimeout": "Proxy connect timeout (s)", - "vhProxyHeaderTimeout": "Proxy response header timeout (s)", - "vhProxyReadTimeout": "Proxy read timeout (s)", - "vhProxySendTimeout": "Proxy send timeout (s)", + "vhProxyConnectTimeout": "Timeout połączenia z backendem (s)", + "vhProxyHeaderTimeout": "Timeout nagłówków odpowiedzi backendu (s)", + "vhProxyReadTimeout": "Timeout odczytu z backendu (s)", + "vhProxySendTimeout": "Timeout wysyłania do backendu (s)", "vhProxyTimeoutsHelp": "Domyślnie: połączenie 10 s, nagłówki odpowiedzi 120 s, odczyt 60 s i wysyłanie 60 s. Read/send to timeout bezczynności podczas streamowania body.", "notfoundModeCloudflare": "Strona statusu w stylu Cloudflare (offline)", "notfoundModeCloudflareWelcome": "Strona gratulacyjna w stylu Cloudflare (offline)", @@ -1989,12 +1988,12 @@ "certificateExpiresSoon": "Certyfikat wkrótce wygaśnie", "certificateRenewalStatus": "Status odnawiania", "certificateRenewalError": "Ostatni błąd odnawiania", - "vhActiveHealth": "Active health", + "vhActiveHealth": "Aktywne sprawdzanie zdrowia", "vhPassiveFailures": "Błędy passive health", "certificateAdminRestartRequired": "TLS panelu administracyjnego używa konfiguracji ładowanej przy starcie; uruchom ponownie RustProxy, aby odświeżyć ten certyfikat.", "cacheTabGeneral": "Ogólne", "cacheTabResilience": "Odporność", - "cacheTabCold": "Cold cache", + "cacheTabCold": "Zimny cache", "cacheTabDiagnostics": "Statyczne i diagnostyka", "certificateApiTitle": "API certyfikatów", "certificateApiHelp": "Klucze pozwalają zewnętrznej automatyzacji (Certbot, acme.sh, klient ACME w OPNsense) przeładowywać lub wgrywać certyfikaty. Klucz działa tylko dla wybranych certyfikatów i nie może czytać konfiguracji ani używać innych API administracyjnych.", @@ -2108,6 +2107,33 @@ "webServiceSearchPlaceholder": "Szukaj nazwy, ID lub document root", "webServiceNew": "Nowa usługa WWW", "webServiceEditor": "Konfiguracja usługi WWW", + "webServiceKindStatic": "Pliki statyczne", + "webServiceUsed": "Użyta", + "copySuffix": "kopia", + "webServiceCardFastCgi": "Backend FastCGI", + "webServiceCardIndex": "Index / try_files", + "webServiceCardWarnings": "ostrz.", + "webServiceCardDelivery": "Dostarczanie", + "webServiceCardPrecompressed": "gotowe br/gzip z dysku", + "webServiceCardRules": "reguł", + "webServiceCardAttacks": "blokada skanów", + "webServiceCardHeaders": "bez nagłówków fingerprint", + "webServiceKindTitle": "Rodzaj usługi", + "webServiceGeneralSection": "Ustawienia ogólne", + "phpProfileEdit": "Edytuj profil", + "webServiceKindStaticHelp": "HTML, obrazy; cache i gotowe pliki skompresowane", + "webServiceKindSpaHelp": "nieznane ścieżki → index.html", + "webServiceKindPhp": "Aplikacja PHP", + "webServiceKindPhpHelp": "PHP-FPM z profilem wybranej aplikacji", + "webServiceKindDownloadsHelp": "listing katalogu i pobieranie", + "webServiceKindCustomHelp": "bez ustawień wstępnych; zostawia obecne ustawienia", + "phpSourceProfile": "Wspólny profil FastCGI", + "phpSourceProfileHelp": "te same ustawienia w wielu usługach", + "phpSourceLocal": "Ustawienia tej usługi", + "phpSourceLocalHelp": "FastCGI / PHP-FPM ustawiane tylko tutaj", + "phpProfileUsedCount": "usługi: {count}", + "phpProfileSectionConnection": "Profil i połączenie", + "phpProfileLabel": "Profil", "webServiceTabGeneral": "Ogólne", "webServiceTabRouting": "Routing", "webServiceTabMime": "MIME", @@ -2117,7 +2143,7 @@ "webServiceTabSecurity": "Bezpieczeństwo", "webServiceId": "ID usługi", "webServiceName": "Nazwa", - "webServiceRoot": "Document root", + "webServiceRoot": "Katalog główny (document root)", "webServiceIndex": "Pliki index", "webServiceDirectoryListing": "Listowanie katalogu", "webServiceMimeOverrides": "Nadpisania MIME", @@ -4491,6 +4517,179 @@ "webServiceFastCgiHandlerHelp": "Wybierz backend: PHP-FPM wykonuje PHP, fcgiwrap uruchamia programy CGI, a ogólny responder FastCGI obsługuje zgodne aplikacje. Dla różnych katalogów lub socketów użyj osobnych Web Service i lokalizacji Vhost.", "webServiceFastCgiScriptPrefix": "Publiczny prefiks SCRIPT_NAME", "webServiceFastCgiScriptPrefixHelp": "Jeśli reguła Vhost usuwa prefiks URL (np. /app/cgi-bin), wpisz go tutaj. Prefiks jest dodawany do SCRIPT_NAME; SCRIPT_FILENAME pozostaje w katalogu usługi.", - "pageCloudflareAll": "Użyj stylu Cloudflare dla wszystkich stron" + "pageCloudflareAll": "Użyj stylu Cloudflare dla wszystkich stron", + "dockerLiveViewHelp": "Odświeżaj ten widok z pamięci RustProxy co 5 sekund", + "trafficLegendAria": "Żądania na sekundę według protokołu HTTP oraz tempo odpowiedzi przekształconych", + "trafficLegendTotal": "Razem", + "redirectTabDetails": "Szczegóły", + "redirectFrontendTab": "Frontend", + "redirectTestUrl": "Sprawdź adres na niezapisanych regułach", + "redirectStepWhen": "Kiedy — dopasowanie", + "redirectStepWhere": "Dokąd — cel", + "redirectTargetUrlHelp": "stały adres", + "redirectTargetHostHelp": "ścieżka z żądania", + "redirectTargetPathHelp": "ten sam host", + "redirectChipHttpOnly": "tylko HTTP", + "redirectChipHttpsOnly": "tylko HTTPS", + "redirectChipStrip": "obetnij prefiks", + "redirectChipReplace": "stała ścieżka", + "redirectChipNoQuery": "bez query", + "redirectChipCache": "cache", + "redirectTplDomain": "Cały host → nowa domena", + "redirectTplDomainHelp": "Każda ścieżka na inny host, ścieżka i query zachowane (301).", + "redirectTplHttps": "HTTP → HTTPS", + "redirectTplHttpsHelp": "Żądania HTTP na adres HTTPS wskazanego hosta (308).", + "redirectTplPage": "Jedna ścieżka → URL", + "redirectTplPageHelp": "Dokładna ścieżka na stały adres (301).", + "redirectTplDirectory": "Katalog → inny host", + "redirectTplDirectoryHelp": "Prefiks ścieżki na inny host bez tego prefiksu (301).", + "redirectTplBlank": "Pusta reguła", + "redirectTplBlankHelp": "Reguła domyślna; wszystkie pola uzupełniasz samodzielnie.", + "redirectTestHint": "Wpisz adres URL lub ścieżkę (/blog/post?x=1). Wynik korzysta z reguł z tego formularza, przed zapisem.", + "redirectTestInvalid": "To nie jest poprawny adres http(s) ani ścieżka.", + "redirectTestOtherHost": "to nie jest nazwa hosta tego przekierowania; obsłuży go inny host.", + "redirectTestNoRule": "Żadna włączona reguła nie pasuje — żądanie zostanie obsłużone jak dla nieznanego hosta.", + "redirectDisableConfirm": "Wyłączyć teraz ten host przekierowań? Po zapisie jego nazwy przestaną przekierowywać.", + "redirectDisable": "Wyłącz", + "redirectEnable": "Włącz", + "redirectRuleOne": "reguła", + "redirectRuleMany": "reguł", + "redirectRulesEnabled": "włączone", + "redirectRulesDisabled": "wyłączone", + "redirectStateOn": "Włączone", + "redirectStateOff": "Wyłączone", + "redirectRuleFew": "reguły", + "redirectTargetLabelUrl": "Docelowy adres URL", + "redirectTargetLabelHost": "Host docelowy[:port]", + "redirectTargetLabelPath": "Ścieżka docelowa", + "notfoundResponseTab": "Odpowiedź", + "notfoundKindWelcomeHelp": "Neutralna strona „tu nic nie ma”.", + "notfoundKindBuiltinHelp": "Wbudowana strona błędu.", + "notfoundKindCloudflare": "Styl Cloudflare (offline)", + "notfoundKindCloudflareHelp": "Strona statusu, powitanie lub placeholder.", + "notfoundKindEmptyHelp": "Bez treści, tylko status.", + "notfoundKindHtmlHelp": "Wklej kod strony (bez zewnętrznych zasobów).", + "notfoundCloudflareVariant": "Wariant Cloudflare", + "notfoundVariantError": "Strona statusu", + "notfoundVariantWelcome": "Powitanie", + "notfoundVariantPlaceholder": "Placeholder", + "notfoundPreview": "Podgląd", + "notfoundPreviewOpen": "Otwórz w nowej karcie", + "notfoundPreviewHtmlUnsaved": "Własny HTML pojawi się w podglądzie po pierwszym zapisie tego hosta.", + "notfoundPreviewHtmlSaved": "Podgląd pokazuje zapisany HTML; zapisz, aby zobaczyć zmiany.", + "notfoundPreviewEmpty": "Ta odpowiedź nie ma treści: przeglądarka pokaże własną pustą stronę.", + "notfoundStateOn": "Włączony", + "notfoundStateOff": "Wyłączony", + "notfoundDisableConfirm": "Wyłączyć teraz ten host 404? Po zapisie przestanie odpowiadać dla swoich nazw.", + "streamBackendsTab": "Backendy", + "streamHealthTab": "Health", + "streamWeightShort": "waga", + "streamChipDrain": "drenowanie", + "streamChipMax": "maks.", + "streamChipNoHealth": "bez health checku", + "streamChipUdpProbe": "sonda UDP", + "streamChipMetricsOn": "metryki szczegółowe", + "streamChipMetricsOff": "bez metryk szczegółowych", + "streamBackendCountOne": "backend", + "streamBackendCountFew": "backendy", + "streamBackendCountMany": "backendów", + "streamLimitConnections": "połączeń", + "streamConnectShort": "łączenie", + "streamDisableConfirm": "Wyłączyć teraz ten stream? Po zastosowaniu zmiany jego listener przestanie przyjmować połączenia.", + "settingsGroupPanel": "Panel", + "settingsGroupNetwork": "Sieć i wejście", + "settingsGroupTraffic": "Ruch i odpowiedzi", + "settingsGroupObservability": "Obserwowalność", + "settingsGroupAdministration": "Administracja", + "settingsGroupTls": "TLS i certyfikaty", + "dockerAgentSectionConnection": "Połączenie", + "dockerAgentSectionAuth": "Uwierzytelnianie i TLS", + "dockerAgentSectionDomains": "Domeny i certyfikaty", + "dockerAgentSectionPublish": "Domyślna publikacja usług", + "listenerSectionIdentity": "Tożsamość i adresy", + "listenerSectionProtocols": "Protokoły", + "pageKindInheritHelp": "bez zmian, zachowanie wbudowane", + "pageDirectIpWhen": "Ktoś wpisał adres IP serwera zamiast domeny (np. skaner albo bot).", + "pageUnknownHostWhen": "DNS wskazuje domenę na ten serwer, ale nie obsługuje jej żaden vhost, przekierowanie ani host 404.", + "pageErrorsWhen": "Podmienia treść błędów generowanych przez RustProxy i statusów przechwytywanych przez vhost; status zostaje, chyba że wybierzesz inny.", + "pageStaticHostWhen": "Każde żądanie do tego vhosta dostaje tę stronę zamiast backendu.", + "pageMissingPathWhen": "Żądanie nie pasuje do żadnej trasy tego vhosta.", + "pagePreviewInheritDirectIp": "Bez ustawienia: żądanie na adres IP jest obsługiwane jak nieznany host.", + "pagePreviewInheritUnknown": "Bez ustawienia: zwykły tekst „RustProxy: no route for this host/path” ze statusem 404.", + "pagePreviewInheritError": "Bez ustawienia: odpowiedź błędu idzie bez zmian (z backendu albo krótki tekst RustProxy).", + "pagePreviewInheritVhost": "Bez ustawienia: użyta zostanie strona globalna z Ustawienia → Domyślne odpowiedzi.", + "pagePreviewHtmlUnsaved": "Własny HTML pojawi się w podglądzie po zapisie.", + "cacheFlowIntro": "Jak żądanie przechodzi przez cache. Kliknij krok, aby otworzyć jego ustawienia.", + "cacheFlowTitle": "Przebieg żądania przez cache", + "settingsFlowOpenTab": "Otwórz te ustawienia", + "cacheFlowHit": "odpowiedź z pamięci lub dysku, bez pytania backendu", + "cacheFlowMiss": "pobrane z backendu i zapisane, jeśli można cache'ować", + "cacheFlowBypass": "reguła lub prefiks pomija cache", + "cacheFlowDisabled": "Cache jest wyłączony globalnie: każde żądanie trafia prosto do backendu.", + "cacheFlowSieTimeout": "timeout", + "cacheFlowSieConnection": "połączenie", + "cacheFlowClient": "Klient", + "cacheFlowClientLine": "żądanie GET / HEAD", + "cacheFlowRules": "Reguły", + "cacheFlowRulesCount": "reguł", + "cacheFlowSkipQuery": "?query → pomiń", + "cacheFlowKeepQuery": "?query cache'owane osobno", + "cacheFlowPrefixes": "prefiksów pominięcia", + "cacheFlowHot": "HOT (RAM)", + "cacheFlowEntries": "wpisów", + "cacheFlowMaxObject": "maks. obiekt", + "cacheFlowMaxTtl": "maks. TTL", + "cacheFlowCold": "COLD (dysk)", + "cacheFlowColdLine": "wypchnięte z RAM, trzymane na dysku", + "cacheFlowColdOff": "wyłączony", + "cacheFlowBackend": "Backend", + "cacheFlowMissLine": "pytany tylko przy MISS", + "cacheFlowNoGrace": "bez grace", + "cacheFlowNoStale": "bez stale-if-error", + "cacheTimelineStored": "Zapisane", + "cacheTimelineStoredLine": "świeża kopia podawana jako HIT", + "cacheTimelineProactiveLine": "popularnych wpisów odświeżanych w tle", + "cacheTimelineAfterTtl": "TTL minął", + "cacheTimelineGraceLine": "stara kopia podawana, gdy backend się odświeża", + "cacheTimelineNoGraceLine": "następne żądanie czeka na backend", + "cacheTimelineBackendDown": "Backend nie odpowiada", + "transformFlowTitle": "Przebieg transformacji odpowiedzi", + "transformFlowBackend": "Backend", + "transformFlowBackendLine": "odpowiedź, może być skompresowana", + "transformFlowDecode": "Dekompresja", + "transformFlowDecodeLine": "gzip / deflate / br / zstd → tekst", + "transformFlowTransform": "Transformacja", + "transformFlowNoOps": "brak włączonych operacji", + "transformFlowMaxBody": "do", + "transformFlowNoTransform": "pomija Cache-Control: no-transform", + "transformFlowCache": "Cache", + "transformFlowCacheLine": "zapisuje mniejszy wynik", + "transformFlowEncode": "Kompresja", + "transformFlowClientLine": "mniej bajtów do pobrania", + "transformFlowDisabled": "Transformacja jest wyłączona globalnie: odpowiedzi przechodzą bez zmian.", + "transformExampleBefore": "Przed", + "transformExampleAfter": "Po", + "transformJavascriptHelp": "Usuwa wcięcia i nadmiarowe spacje; komentarze i kod zostają bez zmian.", + "transformCssHelp": "Usuwa komentarze i białe znaki z arkuszy stylów.", + "transformHtmlHelp": "Usuwa komentarze HTML (komentarze warunkowe oraz treść script/style zostają).", + "transformSvgHelp": "Usuwa komentarze z plików SVG (CDATA zostaje).", + "transformJsonHelp": "Usuwa białe znaki formatowania z JSON.", + "securitySummaryAccount": "Administrator", + "securitySummaryTokens": "Tokeny API", + "securitySummaryTokensLine": "ograniczone do adresów źródłowych", + "securitySummaryPolicies": "Polityki dostępu hostów", + "securitySummaryPoliciesLine": "hosty z własnymi regułami IP", + "securitySummaryNoPolicies": "dostęp ograniczają tylko ACL tras i vhostów", + "policyDefaultAllowTitle": "Domyślnie zezwalaj", + "policyDefaultAllowHelp": "blokuj tylko wymienione reguły deny", + "policyDefaultDenyTitle": "Domyślnie blokuj", + "policyDefaultDenyHelp": "zezwól tylko wymienionym regułom allow", + "policySimulatorTitle": "Jak zadecyduje? Sprawdź adresy IP klientów (po przecinku)", + "policySimulatorInvalidIp": "to nie jest adres IP", + "policySimulatorMatches": "pasuje do", + "policySimulatorNoMatch": "brak pasującej reguły → domyślnie", + "policySimulatorDns": "Reguły z nazwą hosta (np. office.example.com) są rozwiązywane w działaniu i nie są częścią tej symulacji.", + "policySimulatorAllowed": "ZEZWOLONY", + "transformFlowEncodeLine": "kompresja globalna z nadpisaniem w vhoście (zstd / br / gzip / deflate)" } } \ No newline at end of file diff --git a/src/admin/openapi.json b/src/admin/openapi.json index 0f0b9d7..cfff8d3 100644 --- a/src/admin/openapi.json +++ b/src/admin/openapi.json @@ -16457,6 +16457,106 @@ ] } }, + "/api/pages/preview": { + "get": { + "summary": "Preview a local page (404 hosts) as the proxy would render it", + "tags": [ + "Configuration" + ], + "operationId": "get_api_pages_preview", + "parameters": [ + { + "name": "kind", + "in": "query", + "required": true, + "schema": { + "type": "string", + "enum": [ + "welcome", + "empty", + "html", + "builtin", + "cloudflare", + "cloudflare_welcome", + "cloudflare_placeholder" + ] + } + }, + { + "name": "status", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 200, + "maximum": 599, + "default": 404 + } + }, + { + "name": "host", + "in": "query", + "required": false, + "description": "404 host ID; with kind=html previews that host's saved custom HTML", + "schema": { + "type": "string" + } + }, + { + "name": "slot", + "in": "query", + "required": false, + "description": "With kind=html: saved default response to preview — direct_ip, unknown_host, response, fallback or error-", + "schema": { + "type": "string" + } + }, + { + "name": "vhost", + "in": "query", + "required": false, + "description": "With slot: read the per-vhost default responses of this vhost instead of the global ones", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Rendered page body, served with a sandbox Content-Security-Policy (opaque origin, no scripts) and framing limited to the panel", + "content": { + "text/html": { + "schema": { + "type": "string" + } + }, + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "Invalid kind or status" + }, + "401": { + "description": "Authentication required" + }, + "403": { + "description": "Invalid origin" + }, + "404": { + "description": "No saved custom HTML for this 404 host or default response" + } + }, + "security": [ + { + "AdminSession": [] + } + ] + } + }, "/api/certificate-api/{key_id}/regenerate": { "post": { "summary": "Regenerate an existing bearer token, preserving its settings and Key ID", diff --git a/src/admin/operations.rs b/src/admin/operations.rs index 2e3f51f..817d65e 100644 --- a/src/admin/operations.rs +++ b/src/admin/operations.rs @@ -337,3 +337,82 @@ struct CertificateDeploy { cert_pem: String, key_pem: String, } + +/// Query for the local page preview used by the 404 host editor. +#[derive(Default, Deserialize)] +#[serde(default, deny_unknown_fields)] +struct PagePreviewQuery { + kind: String, + status: Option, + /// 404 host ID whose saved custom HTML is previewed. + host: Option, + /// Saved custom HTML of a default response: `direct_ip`, `unknown_host`, + /// `response`, `fallback` or `error-`; with `vhost` for per-vhost pages. + slot: Option, + vhost: Option, +} + +/// Renders a built-in local page (or the saved custom HTML of a 404 host) +/// exactly as `Page::render` serves it. The session guard sends this response +/// with a sandbox CSP, so the document runs in an opaque origin without +/// scripts and may only be framed by the panel itself. +async fn page_preview( + State(state): State>, + Query(query): Query, +) -> Result { + let kind: crate::pages::Kind = serde_json::from_value(Value::String(query.kind.clone())) + .map_err(|_| ApiError(StatusCode::BAD_REQUEST, "invalid page kind".into()))?; + let html = if matches!(kind, crate::pages::Kind::Html) { + let snapshot = state.config.load_full(); + let config = &snapshot.envelope.config; + let saved = if let Some(id) = query.host.as_deref() { + config + .not_found_hosts + .iter() + .find(|host| host.id == id) + .map(|host| &host.page) + } else { + let slot = query.slot.as_deref().unwrap_or_default(); + let error = slot + .strip_prefix("error-") + .and_then(|code| code.parse::().ok()); + match query.vhost.as_deref() { + Some(id) => config.vhosts.iter().find(|vhost| vhost.id == id).and_then(|vhost| { + match (slot, error) { + ("response", _) => vhost.pages.response.as_ref(), + ("fallback", _) => vhost.pages.fallback.as_ref(), + (_, Some(code)) => vhost.pages.errors.get(&code), + _ => None, + } + }), + None => match (slot, error) { + ("direct_ip", _) => config.pages.direct_ip.as_ref(), + ("unknown_host", _) => config.pages.unknown_host.as_ref(), + (_, Some(code)) => config.pages.errors.get(&code), + _ => None, + }, + } + }; + saved + .filter(|page| matches!(page.kind, crate::pages::Kind::Html)) + .map(|page| page.html.clone()) + .ok_or_else(|| ApiError(StatusCode::NOT_FOUND, "saved custom page not found".into()))? + } else { + String::new() + }; + let page = crate::pages::Page { + kind, + status: Some(query.status.unwrap_or(404)), + html, + }; + page.validate_local_response() + .map_err(|error| ApiError(StatusCode::BAD_REQUEST, error.to_string()))?; + let mut response = page.render(StatusCode::NOT_FOUND); + *response.status_mut() = StatusCode::OK; + response.extensions_mut().insert(PagePreview); + Ok(response) +} + +/// Marks a sandboxed page preview for the session guard. +#[derive(Clone, Copy)] +struct PagePreview; diff --git a/src/admin/router.rs b/src/admin/router.rs index d8b9949..432fc9c 100644 --- a/src/admin/router.rs +++ b/src/admin/router.rs @@ -187,6 +187,7 @@ pub fn router(state: Arc) -> Router { .route("/api/acl/dns-status", get(dns_acl_status)) .route("/api/web-services/htaccess-warnings", get(web_service_htaccess_warnings)) .route("/api/system-info", get(system_info)) + .route("/api/pages/preview", get(page_preview)) .route("/api/backends", get(backend_status)) .route("/api/alerts", get(alerts_status)) .route("/api/docker", get(docker_status)) diff --git a/src/admin/session.rs b/src/admin/session.rs index 314e0ae..87dbd2e 100644 --- a/src/admin/session.rs +++ b/src/admin/session.rs @@ -406,6 +406,15 @@ async fn guard(State(state): State>, mut request: Request, next: Next) } } } + if response.extensions().get::().is_some() && response.status().is_success() { + // Rendered page previews may contain operator HTML: no scripts, an + // opaque origin, and framing only by the panel itself. + response.headers_mut().insert("content-security-policy", HeaderValue::from_static( + "sandbox; default-src 'none'; style-src 'unsafe-inline'; img-src data:; font-src data:; base-uri 'none'; form-action 'none'; frame-ancestors 'self'")); + response + .headers_mut() + .insert("x-frame-options", HeaderValue::from_static("SAMEORIGIN")); + } if matches!(path.as_str(), "/docs" | "/docs/") && response.status().is_success() { response.headers_mut().insert("content-security-policy", HeaderValue::from_static( "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; font-src 'self'; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'")); diff --git a/src/admin/tests.rs b/src/admin/tests.rs index 7e44944..dfdc540 100644 --- a/src/admin/tests.rs +++ b/src/admin/tests.rs @@ -3859,6 +3859,102 @@ mod tests { assert!(newest_log_files(std::iter::once(("x".into(), "x".into(), 1)), 0).is_empty()); } + #[tokio::test] + async fn page_preview_is_sandboxed_and_reads_only_saved_custom_html() { + let mut config = config::demo_config("127.0.0.1:9000".parse().unwrap()); + config.not_found_hosts = serde_json::from_value(json!([{ + "id":"custom", + "frontend":{"hosts":["custom.localhost"],"listener_ids":["http"]}, + "page":{"kind":"html","status":404,"html":"

Saved page

"} + }, { + "id":"parked", + "frontend":{"hosts":["parked.localhost"],"listener_ids":["http"]}, + "page":{"kind":"cloudflare","status":404} + }])) + .unwrap(); + config.pages.unknown_host = Some(crate::pages::Page { + kind: crate::pages::Kind::Html, + status: Some(404), + html: "

Global unknown host

".into(), + }); + config.pages.errors.insert( + 502, + crate::pages::Page { + kind: crate::pages::Kind::Html, + status: None, + html: "

Global 502

".into(), + }, + ); + let vhost_id = config.vhosts[0].id.clone(); + config.vhosts[0].pages.fallback = Some(crate::pages::Page { + kind: crate::pages::Kind::Html, + status: Some(404), + html: "

Vhost fallback

".into(), + }); + let (router, _store, _dir, secret, _) = fixture_with_config(config).await; + let cookie = format!("{}={secret}", auth::COOKIE_NAME); + let get = |path: &str, authenticated: bool| { + let mut builder = request(path); + if authenticated { + builder = builder.header("cookie", &cookie); + } + router.clone().oneshot(builder.body(Body::empty()).unwrap()) + }; + let anonymous = get("/api/pages/preview?kind=welcome", false).await.unwrap(); + assert_eq!(anonymous.status(), StatusCode::UNAUTHORIZED); + for path in [ + "/api/pages/preview?kind=welcome", + "/api/pages/preview?kind=cloudflare&status=410", + "/api/pages/preview?kind=builtin&status=503", + "/api/pages/preview?kind=cloudflare_placeholder", + "/api/pages/preview?kind=html&host=custom&status=404", + ] { + let response = get(path, true).await.unwrap(); + assert_eq!(response.status(), StatusCode::OK, "{path}"); + let csp = response.headers()["content-security-policy"].to_str().unwrap(); + assert!(csp.starts_with("sandbox;"), "{path}: {csp}"); + assert!(!csp.contains("script-src"), "{path}: {csp}"); + assert!(csp.contains("frame-ancestors 'self'"), "{path}: {csp}"); + assert_eq!(response.headers()["x-frame-options"], "SAMEORIGIN"); + assert_eq!( + response.headers()["cache-control"], + "private, no-store, no-cache, no-transform" + ); + let body = axum::body::to_bytes(response.into_body(), 256 * 1024) + .await + .unwrap(); + assert!(!body.is_empty(), "{path}"); + if path.contains("kind=html") { + assert!(String::from_utf8_lossy(&body).contains("Saved page")); + } + } + for (path, expected) in [ + ("/api/pages/preview?kind=html&slot=unknown_host".to_string(), "Global unknown host"), + ("/api/pages/preview?kind=html&slot=error-502&status=502".to_string(), "Global 502"), + (format!("/api/pages/preview?kind=html&vhost={vhost_id}&slot=fallback"), "Vhost fallback"), + ] { + let response = get(&path, true).await.unwrap(); + assert_eq!(response.status(), StatusCode::OK, "{path}"); + assert!(response.headers()["content-security-policy"].to_str().unwrap().starts_with("sandbox;")); + let body = axum::body::to_bytes(response.into_body(), 256 * 1024).await.unwrap(); + assert!(String::from_utf8_lossy(&body).contains(expected), "{path}"); + } + for (path, status) in [ + ("/api/pages/preview?kind=html&slot=direct_ip", StatusCode::NOT_FOUND), + ("/api/pages/preview?kind=html&slot=error-404", StatusCode::NOT_FOUND), + ("/api/pages/preview?kind=html&vhost=missing&slot=fallback", StatusCode::NOT_FOUND), + ("/api/pages/preview?kind=html&host=parked", StatusCode::NOT_FOUND), + ("/api/pages/preview?kind=html&host=missing", StatusCode::NOT_FOUND), + ("/api/pages/preview?kind=html", StatusCode::NOT_FOUND), + ("/api/pages/preview?kind=bogus", StatusCode::BAD_REQUEST), + ("/api/pages/preview?kind=welcome&status=99", StatusCode::BAD_REQUEST), + ("/api/pages/preview?kind=welcome&extra=1", StatusCode::BAD_REQUEST), + ] { + let response = get(path, true).await.unwrap(); + assert_eq!(response.status(), status, "{path}"); + assert_eq!(response.headers()["x-frame-options"], "DENY", "{path}"); + } + } #[tokio::test] async fn system_info_and_compact_live_status_reuse_existing_admin_session() { let (router, store, _dir, secret, _) = fixture().await; diff --git a/src/admin/web/acme.js b/src/admin/web/acme.js index 29ce6b4..b874eec 100644 --- a/src/admin/web/acme.js +++ b/src/admin/web/acme.js @@ -52,7 +52,7 @@ $("certificate-acme-editor").hidden = !acme; $("certificate-upload-form").hidden = provider !== "import"; $("certificate-advanced").hidden = provider !== "existing"; - $("certificate-provider-hint").textContent = t(`providerHint_${provider}`); + const hint = $("certificate-provider-hint"); hint.dataset.i18n = `providerHint_${provider}`; hint.textContent = t(hint.dataset.i18n); for (const node of document.querySelectorAll("[data-acme-provider]")) { const visible = acme && (node.dataset.acmeProvider === provider || (node.dataset.acmeProvider === "dns" && provider !== "http01")); node.hidden = !visible; diff --git a/src/admin/web/app/core.js b/src/admin/web/app/core.js index 2d40d77..fd78c1f 100644 --- a/src/admin/web/app/core.js +++ b/src/admin/web/app/core.js @@ -119,6 +119,8 @@ function clearFormFieldErrors(form) { form?.querySelectorAll(".field-invalid,[ar function showFieldError(error, form = null) { let target = error?.fieldTarget; if (typeof target === "string") target = $(target); if (!target || (form && !form.contains(target))) return false; + for (let holder = target.closest?.("details"); holder; holder = holder.parentElement?.closest("details")) holder.open = true; + target.closest?.(".listener-card.is-collapsed")?.querySelector(".listener-card-head")?.click(); const focusTarget = target.matches?.("input,select,textarea,button") ? target : target.querySelector?.("input,select,textarea,button"); target.classList?.add("field-invalid"); target.setAttribute?.("aria-invalid", "true"); const clear = () => clearFieldError(target); target.addEventListener?.("input", clear, { once: true }); target.addEventListener?.("change", clear, { once: true }); @@ -517,7 +519,7 @@ function parseRules(text, target = null) { } function renderConfig() { if (!envelope) return; window.rustProxyCachePanel?.configure(); renderCertificates(); renderSettings(); window.rustProxyPages?.render(); window.rustProxyAclProfiles?.render(); window.rustProxyVhosts?.render(); window.rustProxyWebServer?.render(); window.rustProxyDocker?.render(); window.rustProxyRedirects?.render(); window.rustProxyNotFound?.render(); window.rustProxyStreams?.render(); const config = envelope.config; if (!settingsDirty.has("config-editor")) $("config-editor").value = JSON.stringify(config, null, 2); - $("host-policy-list").replaceChildren(...(config.host_policies || []).map((policy, index) => { const box = el("div", undefined, "entity"); box.append(el("span", policy.hosts.join(", "), "entity-title"), el("p", `${t("aclDefault")}: ${t(policy.acl.default || "deny")}\n${rulesText(policy.acl)}`, "entity-details")); const buttons = el("div", undefined, "entity-actions"); buttons.append(action(t("edit"), () => { $("policy-hosts").value = policy.hosts.join(", "); $("policy-default").value = policy.acl.default || "deny"; $("policy-rules").value = rulesText(policy.acl); const editor = $("security-policy-editor"); if (editor) { editor.open = true; editor.scrollIntoView({ block: "nearest" }); } }), action(t("remove"), async () => { if (await appConfirm(t("confirmDelete"), { danger: true })) { const next = structuredClone(config); next.host_policies.splice(index, 1); await saveSection("host-policies", next.host_policies); } })); box.append(buttons); return box; })); + $("host-policy-list").replaceChildren(...(config.host_policies || []).map((policy, index) => { const box = el("div", undefined, "entity"); box.append(el("span", policy.hosts.join(", "), "entity-title"), el("p", `${t("aclDefault")}: ${t(policy.acl.default || "deny")}\n${rulesText(policy.acl)}`, "entity-details")); const buttons = el("div", undefined, "entity-actions"); buttons.append(action(t("edit"), () => { $("policy-hosts").value = policy.hosts.join(", "); $("policy-default").value = policy.acl.default || "deny"; $("policy-rules").value = rulesText(policy.acl); window.rustProxySecurityPage?.syncPolicy(); const editor = $("security-policy-editor"); if (editor) { editor.open = true; editor.scrollIntoView({ block: "nearest" }); } }), action(t("remove"), async () => { if (await appConfirm(t("confirmDelete"), { danger: true })) { const next = structuredClone(config); next.host_policies.splice(index, 1); await saveSection("host-policies", next.host_policies); } })); box.append(buttons); return box; })); if (!config.host_policies?.length) $("host-policy-list").append(el("p", t("noPolicies"), "empty")); if ($("security-policy-count")) $("security-policy-count").textContent = String((config.host_policies || []).length); } diff --git a/src/admin/web/app/settings.js b/src/admin/web/app/settings.js index 1f899c0..71bac5f 100644 --- a/src/admin/web/app/settings.js +++ b/src/admin/web/app/settings.js @@ -230,6 +230,7 @@ function setCacheColdPresetSelection(kind) { if (badge) badge.textContent = `${t("cachePresetSelected")}: ${selectedCacheColdPreset ? t("cachePresetRecommended") : t("cachePresetCustom")}`; } function updateCacheMemorySizing() { + window.rustProxySettingsFlow?.renderCache?.(); const detected = effectiveCacheMemory(), badge = $("cache-memory-detected"), warning = $("cache-memory-warning"); if (!badge || !warning) return; const buttons = document.querySelectorAll("[data-cache-memory-preset]"); @@ -311,6 +312,7 @@ function setTransformPresetSelection(kind) { if (badge) badge.textContent = `${t("cachePresetSelected")}: ${transformPresetName(selectedTransformPreset)}`; } function updateTransformResourceSizing() { + window.rustProxySettingsFlow?.renderTransform?.(); const warning = $("transform-memory-warning"); if (!warning) return; const memoryMiB = Number($("transform-memory-budget")?.value), bodyKiB = Number($("transform-max-body")?.value), inflight = Number($("transform-max-inflight")?.value); const detected = effectiveCacheMemory(); diff --git a/src/admin/web/css/00-tokens.css b/src/admin/web/css/00-tokens.css index a300d31..a95c728 100644 --- a/src/admin/web/css/00-tokens.css +++ b/src/admin/web/css/00-tokens.css @@ -687,24 +687,28 @@ html[data-chart-style] { } html[data-corner-style=square] { + --rp-radius-nested: 0px; --rp-radius-surface: 0px; --rp-radius-control: 0px; --rp-progress-radius: 0px; } html[data-corner-style=subtle] { + --rp-radius-nested: 3px; --rp-radius-surface: 5px; --rp-radius-control: 4px; --rp-progress-radius: 2px; } html[data-corner-style=rounded] { + --rp-radius-nested: 6px; --rp-radius-surface: 12px; --rp-radius-control: 8px; --rp-progress-radius: 4px; } html[data-corner-style=extra] { + --rp-radius-nested: 8px; --rp-radius-surface: 18px; --rp-radius-control: 12px; --rp-progress-radius: 999px; diff --git a/src/admin/web/css/10-base.css b/src/admin/web/css/10-base.css index a190421..feb1e3a 100644 --- a/src/admin/web/css/10-base.css +++ b/src/admin/web/css/10-base.css @@ -146,7 +146,8 @@ html[data-interface-icons="true"] .nav>span:first-of-type, .web-service-page[hidden], .settings-page[hidden], #panel-tls .certificate-page[hidden], -#panel-tls .certificate-editor-card[hidden] { +#panel-tls .certificate-editor-card[hidden], +.check[hidden] { display: none !important; } @@ -832,15 +833,273 @@ progress::-moz-progress-bar { overflow: auto; } +.pages-editors { + border-top: 1px solid var(--line); +} + .page-editor { display: grid; - grid-template-columns: minmax(105px, .9fr) minmax(115px, 1fr) minmax(105px, 1fr); - gap: 6px; - align-items: center; - padding: 7px 0; + min-width: 0; border-bottom: 1px solid var(--line); } +.page-editor-summary { + display: grid; + grid-template-columns: 10px minmax(0, 1fr) minmax(0, max-content); + align-items: center; + gap: 4px 10px; + width: 100%; + min-height: 0; + height: auto; + padding: 9px 10px; + border: 0; + border-radius: 0 !important; + background: transparent; + color: var(--text); + font: inherit; + text-align: left; + white-space: normal; + cursor: pointer; +} + +.page-editor-summary:hover { + background: var(--panel2); +} + +.page-editor-dot { + width: 8px; + height: 8px; + border: 1px solid var(--muted); + border-radius: 50%; +} + +.page-editor.is-custom .page-editor-dot { + border-color: var(--green); + background: var(--green); +} + +.page-editor.is-previewed>.page-editor-summary { + background: var(--panel2); + box-shadow: inset 3px 0 0 var(--accent); +} + +.page-editor-head { + display: grid; + gap: 2px; + min-width: 0; +} + +.page-editor-head .page-label { + font-size: 13px; + font-weight: 600; +} + +.page-when { + margin: 0; + color: var(--muted); + font-size: 11.5px; + line-height: 1.35; +} + +.pages-errors>.page-when { + margin: 0 0 8px; +} + +.page-editor-badges { + display: flex; + flex-wrap: wrap; + justify-content: flex-end; + gap: 4px; + max-width: 260px; + min-width: 0; +} + +.page-kind-pill, +.page-status-pill { + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.page-kind-pill:not(.live) { + border-color: var(--line); + color: var(--muted); +} + +.page-status-pill[hidden] { + display: none; +} + +.page-editor-controls { + display: grid; + gap: 8px; + min-width: 0; + padding: 4px 10px 12px 30px; + background: var(--panel2); + box-shadow: inset 3px 0 0 var(--accent); +} + +.page-editor-controls[hidden] { + display: none; +} + +.page-kind-chips { + display: flex; + flex-wrap: wrap; + gap: 6px; +} + +.page-kind-chips>.page-kind-chip { + margin: 0; +} + +.page-kind-chip { + position: relative; + display: inline-flex; + align-items: center; + min-height: 30px; + padding: 4px 11px; + border: 1px solid var(--line); + border-radius: var(--rp-radius-control, 0px); + background: var(--panel); + color: var(--text); + font-size: 12px; + cursor: pointer; +} + +.page-kind-chip input { + position: absolute; + opacity: 0; + pointer-events: none; +} + +.page-kind-chip:hover { + border-color: var(--muted); +} + +.page-kind-chip.is-selected { + border-color: var(--accent); + box-shadow: inset 0 0 0 1px var(--accent); + color: var(--accent); +} + +.page-kind-chip:has(input:focus-visible) { + outline: 2px solid var(--accent); + outline-offset: 2px; +} + +.page-kind-help { + margin: 0; +} + +.page-editor-fields { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(190px, 260px)); + gap: 8px 12px; +} + +.page-variant-field[hidden], +.page-mode[hidden] { + display: none !important; +} + +:is(.page-variant-field, .page-status-field) { + display: grid; + gap: 4px; +} + +.pages-workspace { + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); + gap: 14px; + align-items: start; +} + +.pages-editors { + display: grid; + align-content: start; + min-width: 0; +} + +.page-preview-pane { + position: sticky; + top: 10px; + display: grid; + gap: 6px; + padding: 10px; + border: 1px solid var(--line); + background: var(--bg); +} + +.page-preview-head { + display: flex; + align-items: baseline; + flex-wrap: wrap; + gap: 4px 8px; +} + +.page-preview-head strong { + font-size: 12px; +} + +.page-preview-open { + margin-left: auto; + color: var(--accent); + font-size: 11px; + text-decoration: none; +} + +.page-preview-open::after { + content: " ↗"; +} + +.page-preview-open[hidden], +.page-preview-pane iframe[hidden], +.page-preview-note[hidden] { + display: none; +} + +.page-preview-pane iframe { + width: 100%; + height: 380px; + border: 1px solid var(--line); + background: #fff; +} + +.page-preview-note { + margin: 0; +} + +#global-pages-fields, +.vh-pages-grid { + container-type: inline-size; +} + +@container (max-width: 820px) { + .pages-workspace { + grid-template-columns: minmax(0, 1fr); + } + + .page-preview-pane { + position: static; + } + + .page-editor-summary { + grid-template-columns: 10px minmax(0, 1fr); + } + + .page-editor-badges { + grid-column: 2; + justify-content: flex-start; + max-width: none; + } + + .page-editor-controls { + padding-left: 12px; + } +} + .page-label { font-size: 11px; font-weight: 500; @@ -882,14 +1141,23 @@ progress::-moz-progress-bar { .pages-errors { - margin: 12px 0; + margin: 14px 0 6px; } .pages-errors>summary { - font-size: 12px; + display: flex; + align-items: center; + gap: 8px; + padding: 6px 0; + font-size: 13px; + font-weight: 600; cursor: pointer; } +.pages-errors .page-editor-list { + border-top: 1px solid var(--line); +} + .window-heading { display: flex; align-items: center; @@ -1749,23 +2017,27 @@ html[data-interface-icons="true"] :is(button, a, summary)>svg.ui-icon { } #php-fpm-profiles-list .fastcgi-profile-summary { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px 8px; cursor: pointer; padding: 4px 6px; overflow-wrap: anywhere; } +#php-fpm-profiles-list .fastcgi-profile-endpoint { + flex: 1 1 100%; + color: var(--muted); + font: 11px var(--mono); +} + #php-fpm-profiles-list .fastcgi-profile-title { font-weight: 600; } -#php-fpm-profiles-list .fastcgi-profile-handler { - display: inline-block; - margin-inline-start: 12px; - padding: 1px 6px; - border: 1px solid var(--line); - border-radius: var(--rp-radius-control, 3px); - color: var(--muted); - font-size: 10px; +#php-fpm-profiles-list .fastcgi-profile-title { + font-size: 14px; } #php-fpm-profiles-list details[open]>.fastcgi-profile-summary { @@ -1774,26 +2046,31 @@ html[data-interface-icons="true"] :is(button, a, summary)>svg.ui-icon { } #php-fpm-profiles-list .fastcgi-profile-editor { - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 12px; + grid-template-columns: minmax(0, 1fr); + gap: 10px; width: 100%; min-width: 0; } -#php-fpm-profiles-list .fastcgi-profile-editor>label { +#php-fpm-profiles-list .fastcgi-profile-section>.vh-grid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 12px; +} + +#php-fpm-profiles-list .fastcgi-profile-section label { display: grid; gap: 4px; min-width: 0; grid-row: auto; } -#php-fpm-profiles-list .fastcgi-profile-editor>label> :is(input, select, textarea) { +#php-fpm-profiles-list .fastcgi-profile-section label> :is(input, select, textarea) { width: 100%; max-width: 100%; min-width: 0; } -#php-fpm-profiles-list .fastcgi-profile-editor>label.fastcgi-profile-identity { +#php-fpm-profiles-list .fastcgi-profile-section label.fastcgi-profile-identity { display: flex; flex-direction: column; align-items: stretch; @@ -1814,23 +2091,14 @@ html[data-interface-icons="true"] :is(button, a, summary)>svg.ui-icon { } -#php-fpm-profiles-list .fastcgi-profile-editor .fastcgi-profile-php-heading { - padding-top: 6px; - border-top: 1px solid var(--line); -} - -#php-fpm-profiles-list .fastcgi-profile-editor .fastcgi-profile-php-heading strong { - font-size: 12px; -} - .fastcgi-php-only-local[hidden], #php-fpm-profiles-list .fastcgi-php-only[hidden], -#php-fpm-profiles-list .fastcgi-profile-php-heading[hidden] { +#php-fpm-profiles-list .fastcgi-profile-section[hidden] { display: none !important; } @media (max-width: 650px) { - #php-fpm-profiles-list .fastcgi-profile-editor { + #php-fpm-profiles-list .fastcgi-profile-section>.vh-grid { grid-template-columns: minmax(0, 1fr); } } \ No newline at end of file diff --git a/src/admin/web/css/30-overview.css b/src/admin/web/css/30-overview.css index ab00148..de3eb72 100644 --- a/src/admin/web/css/30-overview.css +++ b/src/admin/web/css/30-overview.css @@ -609,11 +609,6 @@ html[data-theme=cream] :is(.card, .stat, dialog) { font: 10px var(--mono); } -.redirect-rule legend { - padding: 0 .4rem; - font-weight: 700; -} - .traffic-protocol-legend { display: flex; flex-wrap: wrap; @@ -1333,11 +1328,6 @@ html[data-chart-style] :is(#workspace, dialog) svg polyline { white-space: nowrap; } -.stream-backend-row>legend { - font-weight: 650; - padding: 0 .35rem; -} - .dashboard-widget-toggle:focus-visible, .file-log-tab:focus-visible { outline: 2px solid var(--accent); @@ -2056,11 +2046,44 @@ html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-sty border-radius: var(--rp-radius-surface) !important; } -html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) :is(button:not(.nav):not(.file-log-tab):not(.vhost-backend-trigger):not(.location-tab), input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea, .pill, .vhost-backend-protocol-badge, .overview-widget-type, .quiet, .outline, .primary, .code, .command, .dashboard-widget-toggle, .settings-tabs button, .overview-inline-restore), +html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) :is(button:not(.nav):not(.file-log-tab):not(.vhost-backend-trigger):not(.location-tab):not(.draft-dock-open):not(.draft-dock-remove), input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea, .pill, .vhost-backend-protocol-badge, .overview-widget-type, .quiet, .outline, .primary, .code, .command, .dashboard-widget-toggle, .settings-tabs button, .overview-inline-restore), html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) :is(.nav, .file-log-tab, .vhost-backend-trigger, .backend-column-options, .docker-service-quick-actions a, .docker-service-quick-actions button, .docker-view-toggle, .provider-picker, .renewal-meta-item) { border-radius: var(--rp-radius-control) !important; } +/* Corner style coverage for editor/settings surfaces that have no radius of their own. */ +html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) :is(.acl-policy-mode-card, .acl-policy-builder, .acl-policy-preview, .settings-shortcuts, .top-log-menu-items, .listener-active-summary, .listener-active-item, .listener-card, .named-listener-row, .host-chip-editor, .vhost-chart, .vhost-detail-strip, .vhost-live-metric, .vh-www-panel, .vh-enable-control, .lb-simulator, .rt-tester, .hdr-card, .hdr-preview, .hdr-preview-col, .location-header-direction, .vh-header-empty, .docker-service-row, .docker-agent-summary, .lb-equivalent pre, .policy-visual>p.fine, .location-doc-intro, .docker-agent-security, .policy-action, .policy-condition-builder, .hdr-row, .vh-www-domain-pair, .vh-location, .location-conditions, .location-group, .location-preview, .redirect-tester, .redirect-rule-table, .notfound-preview, .notfound-preview iframe, .page-preview-pane, .page-preview-pane iframe, .page-editor, .settings-flow-step, .settings-flow-example pre, .settings-timeline-step, .security-summary-tile, .acl-simulator, .page-kind-chip) { + border-radius: var(--rp-radius-surface) !important; +} + +html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) :is(#acl-profile-preview-default, .acl-policy-condition, .acl-policy-step, .chart-style-swatches, .listener-active-feature, .host-chip, .vh-www-host-count, .vh-enable-state, .hdr-tag, .notfound-preview-head a, .entity-actions a) { + border-radius: var(--rp-radius-control) !important; +} + +html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) .vh-location>.location-summary { + border-radius: calc(var(--rp-radius-surface) - 1px); +} + +html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) .vh-location[open]>.location-summary { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} + +/* The sparkline runs edge to edge at the bottom of the chart box. */ +html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) .vhost-chart svg { + border-bottom-right-radius: max(0px, calc(var(--rp-radius-surface) - 1px)); + border-bottom-left-radius: max(0px, calc(var(--rp-radius-surface) - 1px)); +} + +/* Filled cells meet the strip corners; clip them to the strip shape. */ +html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) .vhost-detail-strip { + overflow: hidden; +} + +html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) .chart-style-swatches { + overflow: hidden; +} + #panel-overview .stat-meter>.overview-meter { position: relative; display: block; @@ -4080,4 +4103,17 @@ html[data-dashboard-density=ultra] #panel-overview .docker-load-list { border-radius: var(--rp-radius-surface, 0px); background: color-mix(in srgb, var(--accent) 8%, transparent); pointer-events: none; -} \ No newline at end of file +} +/* Nested surfaces: a block inside a dialog, card or floating panel uses a + smaller radius than its container, and the dialog body itself is not a + second framed block inside the dialog. */ +html[data-corner-style] :is(dialog, .card, .stat, .settings-page, .settings-tabs, .draft-dock, .top-log-menu-items, .metric-info-popover, .backend-column-options) * { + --rp-radius-surface: var(--rp-radius-nested, 0px); +} + +html[data-corner-style] dialog>:is(.card, form.card, article.card) { + border-color: transparent; + border-radius: 0; + background: transparent; + box-shadow: none; +} diff --git a/src/admin/web/css/40-editors.css b/src/admin/web/css/40-editors.css index 9e0f797..25e00bf 100644 --- a/src/admin/web/css/40-editors.css +++ b/src/admin/web/css/40-editors.css @@ -615,7 +615,6 @@ .acl-policy-condition span, .listener-active-address, .acl-profile-attached p, -.stream-backend-status-row>span:first-child, .docker-agent-security .fine, .docker-runtime .fine, #panel-tls .certificate-operation-heading strong, @@ -700,20 +699,22 @@ /* Vhost editor: heading and tabs stay on top, only the fields scroll and the save bar is a plain footer. No sticky positioning inside the scrolled area, so long Custom Location editors cannot push the bar into the content. */ -#vhost-dialog[open] { +/* Tabbed editors: heading, summary and tabs stay on top, only the fields + scroll, and the save bar is the dialog footer. */ +:is(#vhost-dialog, #redirect-dialog, #notfound-dialog, #stream-dialog)[open] { display: flex; flex-direction: column; overflow: hidden; } -#vhost-dialog>#vhost-form { +:is(#vhost-dialog, #redirect-dialog, #notfound-dialog, #stream-dialog)>form { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; } -#vhost-form>#vhost-fields { +:is(#vhost-fields, #redirect-fields, #notfound-fields, #stream-fields) { flex: 0 1 auto; min-height: 0; overflow-y: auto; @@ -721,16 +722,12 @@ overscroll-behavior: contain; } -#vhost-form>.card-heading, -#vhost-form>.vh-tabs, -#vhost-form>.vh-live-summary, -#vhost-form>.form-actions, -#vhost-form>.fine { +:is(#vhost-form, #redirect-form, #notfound-form, #stream-form)>:is(.card-heading, .vh-tabs, .vh-live-summary, .form-actions, .fine) { flex: none; position: static; } -#vhost-form>.form-actions { +:is(#vhost-form, #redirect-form, #notfound-form, #stream-form)>.form-actions { margin-top: 8px; } @@ -1277,6 +1274,7 @@ p, } .vh-www-choice { + border-radius: var(--rp-radius-surface, 0px); min-width: 0; display: flex; align-items: flex-start; @@ -1398,34 +1396,129 @@ p, grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } -.redirect-rules, -.stream-backend-list { - display: grid; - gap: 1rem; -} - -.redirect-rule { - border: 1px solid var(--line); - border-radius: var(--rp-radius-surface, 12px); - padding: 1rem; - margin: 0; - min-width: 0; -} - .redirect-rule-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; - padding-top: 8px; - border-top: 1px solid var(--line); } .redirect-card .vhost-detail-strip { + grid-template-columns: repeat(4, minmax(0, 1fr)); +} + +/* Redirect rule rows reuse the Custom location routing table. */ +.redirect-rule-cards { + grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); +} + +.redirect-target-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); } +.redirect-target-choices .vh-www-choice { + padding: 8px 10px; +} + +.redirect-target-choices small { + color: var(--muted); + font-size: 11px; +} + +.redirect-rule-toolbar { + justify-content: flex-start; +} + +.redirect-rule-toolbar>p { + flex: 1 1 320px; + margin: 0; +} + +.redirect-tester { + display: grid; + gap: 6px; + margin-top: 12px; + padding: 10px 12px; + border: 1px dashed var(--line); +} + +.redirect-tester input { + font-family: var(--mono); +} + +.redirect-test-result { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 4px; + margin: 0; + min-height: 18px; + font-size: 12px; + overflow-wrap: anywhere; +} + +.redirect-test-result.is-match strong { + color: var(--green); +} + +.redirect-test-result code { + font: 600 12px var(--mono); +} + +.redirect-rule-table { + display: grid; + margin-top: 10px; + border: 1px solid var(--line); +} + +.redirect-rule-line { + display: grid; + grid-template-columns: 22px 10px 76px minmax(0, 1fr) 40px minmax(0, 1.6fr) minmax(0, .9fr); + align-items: center; + gap: 4px 10px; + padding: 7px 12px; + font-size: 12px; + overflow-wrap: anywhere; +} + +.redirect-rule-line+.redirect-rule-line { + border-top: 1px solid var(--line); +} + +.redirect-rule-line.is-disabled { + color: var(--muted); +} + +.redirect-rule-line.is-disabled .loc-state, +.loc-state.is-off { + background: var(--line); +} + +.redirect-rule-status { + color: var(--accent); + font: 600 11px var(--mono); +} + +.redirect-rule-target { + font: 11px var(--mono); +} + +.redirect-rule-more { + display: block; + color: var(--muted); +} + +.entity-actions button.danger-quiet { + color: var(--red); + border-color: var(--danger-line-strong); +} + +.vh-tab-count { + color: var(--muted); + font-family: var(--mono); +} + .frontend-protocol-controls { margin-block-start: 16px; padding-block-start: 12px; @@ -1816,38 +1909,6 @@ html[data-dashboard-density=ultra] #panel-overview .dashboard-overview-grid>.car font-size: 12px; } -.stream-backend-pool { - display: grid; - gap: .8rem; - min-width: 0; -} - -.stream-backend-row { - min-width: 0; - border: 1px solid var(--line, #454d59); - border-radius: var(--rp-radius-surface, .65rem); - padding: .85rem; -} - -.stream-backend-row>.quiet { - margin-top: .6rem; -} - -.stream-backend-status { - display: grid; - gap: .4rem; - padding: .75rem 0; -} - -.stream-backend-status-row { - display: flex; - flex-wrap: wrap; - gap: .5rem; - align-items: center; - justify-content: space-between; - font-size: .85em; -} - .vh-enable-control.vh-enable-no-hint { grid-template-rows: auto; } @@ -2306,10 +2367,6 @@ html.app-loading, gap: 10px; } -.stream-backend-row>.vh-grid { - gap: 12px; -} - .vh-form :is(input, select, textarea):disabled { opacity: .55; cursor: not-allowed; @@ -2421,93 +2478,103 @@ h2+.fine { } } -.redirect-flow { +/* Stream backends: routing-table rows in the editor and the card. */ +.stream-backend-toolbar { + align-items: end; + justify-content: flex-start; +} + +.stream-backend-toolbar>label { + min-width: min(280px, 100%); +} + +.stream-health-list { display: grid; - grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.4fr); - gap: 12px; - align-items: center; - margin-top: 12px; - padding: 10px 12px; + gap: 10px; +} + +.stream-health-backend { + margin-left: 6px; + color: var(--accent); + font: 600 12px var(--mono); +} + +.stream-backend-status .redirect-rule-line { + grid-template-columns: 22px 10px minmax(0, .8fr) minmax(0, 1fr) 46px minmax(0, 1.4fr) minmax(0, .8fr); +} + +.loc-state.is-unknown { + background: var(--muted); + opacity: .55; +} + +.loc-state.is-ok { + background: var(--green); +} + +.loc-state.is-bad { + background: var(--red); +} + +.stream-backend-live { + color: var(--muted); + font-size: 11px; +} + +/* 404 host response choice cards and sandboxed preview. */ +.notfound-kinds { + grid-template-columns: repeat(2, minmax(0, 1fr)); + margin-bottom: 10px; +} + +.notfound-kinds small { + color: var(--muted); + font-size: 11px; +} + +.notfound-kind-wide { + grid-column: 1 / -1; +} + +.notfound-preview { + display: grid; + gap: 6px; + margin-top: 10px; + padding: 10px; border: 1px solid var(--line); - border-radius: var(--rp-radius-surface, 0); background: var(--bg); } -.redirect-flow-from, -.redirect-flow-to { +.notfound-preview-head { display: flex; - flex-wrap: wrap; - gap: 6px; - min-width: 0; align-items: center; + justify-content: space-between; + gap: 8px; } -.redirect-flow-to { - flex-direction: column; - align-items: flex-start; - gap: 3px; -} - -.redirect-flow-arrow { - color: var(--muted); - font-size: 16px; - line-height: 1; -} - -.redirect-host-chip { - max-width: 100%; - padding: 2px 6px; +.notfound-preview-head a { + padding: 3px 9px; border: 1px solid var(--line); - border-radius: var(--rp-radius-control, 0); - font: 11px/1.45 var(--mono); color: var(--text); - overflow-wrap: anywhere; -} - -.redirect-target { - font: 12px/1.45 var(--mono); - font-weight: 600; - color: var(--green); - overflow-wrap: anywhere; - min-width: 0; -} - -.redirect-target-more { font-size: 11px; - color: var(--muted); + text-decoration: none; } -.redirect-meta { - display: flex; - flex-wrap: wrap; - gap: 4px 18px; - margin-top: 10px; - font-size: 11px; - color: var(--muted); +.notfound-preview iframe { + width: 100%; + height: 320px; + border: 1px solid var(--line); + background: #fff; } -.redirect-meta-item { +.notfound-preview iframe[hidden] { + display: none; +} + +.entity-actions a.notfound-card-preview { display: inline-flex; - gap: 6px; - min-width: 0; -} - -.redirect-meta-item b { - color: var(--text); - font-weight: 600; - overflow-wrap: anywhere; -} - -@media (max-width: 760px) { - .redirect-flow { - grid-template-columns: minmax(0, 1fr); - gap: 6px; - } - - .redirect-flow-arrow { - transform: rotate(90deg); - justify-self: start; - } + align-items: center; + text-decoration: none; } .lb-editor { @@ -3002,3 +3069,51 @@ h2+.fine { opacity: .55; cursor: default; } + +/* Web Service type and FastCGI source choices reuse the Vhost www cards. */ +.web-service-kinds { + grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); +} + +.web-service-php-sources { + grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); +} + +.web-service-kinds .web-service-php-app { + margin-top: 4px; +} + +.vh-www-choice.is-disabled { + opacity: .5; + cursor: not-allowed; +} + +.web-service-php-profile-summary { + grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); +} + +.web-service-php-profile-actions { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +/* Editor dialogs: the title row is followed directly by the tabs. Live + summaries are shown inside the relevant tab (Backend health, Backends); + the identifier is in the title pill and hostnames in the Frontend tab. */ +:is(#vhost-form, #redirect-form, #notfound-form, #stream-form)>.vh-live-summary { + display: none; +} + +.vh-live-summary.vh-live-summary-tab { + margin: 0 0 8px; + padding: 7px 10px; + border: 1px solid var(--line); + border-radius: var(--rp-radius-surface, 0px); + background: var(--panel2); + font-size: 11px; +} + +.vh-live-summary.vh-live-summary-tab[hidden] { + display: none; +} diff --git a/src/admin/web/css/50-settings.css b/src/admin/web/css/50-settings.css index 82d3966..c35516b 100644 --- a/src/admin/web/css/50-settings.css +++ b/src/admin/web/css/50-settings.css @@ -21,16 +21,18 @@ .settings-shortcuts { display: flex; align-items: center; - gap: 10px; - padding: 10px 12px; - border: 1px solid var(--line); + justify-content: flex-end; + gap: 8px; + flex: 1 1 320px; flex-wrap: wrap; - margin-bottom: 10px; + margin-left: auto; } -.settings-shortcuts>div { - flex: 1; - min-width: 170px; +.settings-shortcuts>p { + flex: 1 1 220px; + max-width: 420px; + margin: 0; + text-align: right; } .acme-card { @@ -388,14 +390,10 @@ padding-block: 0; } -#panel-settings .settings-shortcuts { - grid-column: 1/-1; - width: 100%; -} - #panel-settings .settings-filter-row { grid-column: 1/-1; display: flex; + flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; @@ -1374,19 +1372,6 @@ html[data-dashboard-density=normal] #panel-overview .stat>span, white-space: nowrap; } - #panel-settings #settings-tabs button:is([data-settings-tab=listeners], [data-settings-tab=policies], [data-settings-tab=logging], [data-settings-tab=administration], [data-settings-tab=certificate-api]) { - margin-top: 7px; - position: relative; - } - - #panel-settings #settings-tabs button:is([data-settings-tab=listeners], [data-settings-tab=policies], [data-settings-tab=logging], [data-settings-tab=administration], [data-settings-tab=certificate-api])::before { - content: ""; - position: absolute; - top: -5px; - right: 8px; - left: 8px; - border-top: 1px solid var(--line); - } } #cache-form .cache-section-title { @@ -3088,6 +3073,18 @@ html[data-dashboard-density=normal] #panel-overview .stat>span, .docs-link { font-size: 12px; justify-self: start; + color: var(--accent); + text-decoration: none; +} + +.docs-link::after { + content: " ↗"; + font-size: 11px; +} + +.docs-link:hover, +.docs-link:focus-visible { + text-decoration: underline; } .system-info-page { @@ -3552,13 +3549,11 @@ html[data-dashboard-density=normal] #panel-overview .stat>span, min-width: 0; } -.docker-security-grid .docker-wide-field, -.docker-diagnostics-grid .docker-wide-field { +.docker-security-grid .docker-wide-field { grid-column: 1 / -1; } -.docker-security-grid .docker-subheading, -.docker-diagnostics-grid .docker-subheading { +.docker-security-grid .docker-subheading { grid-column: 1 / -1; margin: 8px 0 0; padding-top: 8px; @@ -3570,8 +3565,7 @@ html[data-dashboard-density=normal] #panel-overview .stat>span, text-transform: uppercase; } -.docker-security-grid .docker-subheading:first-child, -.docker-diagnostics-grid .docker-subheading:first-child { +.docker-security-grid .docker-subheading:first-child { margin-top: 0; padding-top: 0; border-top: 0; @@ -3849,4 +3843,603 @@ html[data-dashboard-density=normal] #panel-overview .stat>span, .cache-guide-card { padding: 11px; } -} \ No newline at end of file +} +/* Settings navigation: grouped list, active item marked like other editors. */ +.settings-nav-group { + padding: 10px 10px 4px; + color: var(--muted); + font: 10px var(--mono); + letter-spacing: .1em; + text-transform: uppercase; +} + +.settings-nav-group:first-child { + padding-top: 2px; +} + +.settings-nav-group[hidden] { + display: none; +} + +#panel-settings #settings-tabs button[aria-selected=true] { + border-color: transparent; + background: var(--panel2); + color: var(--text); + box-shadow: inset 3px 0 0 var(--green); + font-weight: 650; +} + +/* Sub-tabs inside a settings page and the certificate views use the same + underlined tabs as the Vhost editor. */ +#panel-settings .settings-tabs.sub-tabs, +#panel-tls .settings-tabs.certificate-tabs { + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: 2px; + padding: 0; + margin-bottom: 12px; + border: 0; + border-bottom: 1px solid var(--line); + background: transparent; + box-shadow: none; +} + +#panel-settings .settings-tabs.sub-tabs button, +#panel-tls .settings-tabs.certificate-tabs button { + width: auto; + min-width: 0; + margin-bottom: -1px; + padding: 8px 12px; + border: 0; + border-bottom: 2px solid transparent; + background: transparent; + color: var(--muted); + text-align: center; + white-space: nowrap; + font-weight: 500; +} + +#panel-settings .settings-tabs.sub-tabs button:hover, +#panel-tls .settings-tabs.certificate-tabs button:hover { + background: var(--panel2); + color: var(--text); +} + +#panel-settings .settings-tabs.sub-tabs button[aria-selected=true], +#panel-tls .settings-tabs.certificate-tabs button[aria-selected=true] { + border-bottom-color: var(--green); + background: transparent; + color: var(--text); + font-weight: 650; + box-shadow: none; +} + +html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) :is(#panel-settings .settings-tabs.sub-tabs, #panel-tls .settings-tabs.certificate-tabs) { + border-radius: 0 !important; +} + +@media (max-width: 760px) { + .settings-nav-group { + display: none; + } + + .settings-shortcuts>p { + text-align: left; + } +} + +/* Docker agents in Settings: routing-table rows with sections. */ +#docker-agent-settings-list { + gap: 9px; +} + +.docker-agent-row.entity, +.docker-agent-row.entity:first-child, +.docker-agent-row.entity:last-child { + padding: 0; + border: 1px solid var(--line); +} + +.docker-agent-summary-row { + grid-template-columns: 12px minmax(0, 1fr) minmax(0, 1.1fr) auto auto; +} + +.docker-agent-summary-title { + display: flex; + align-items: baseline; + flex-wrap: wrap; + gap: 4px 8px; + min-width: 0; +} + +.docker-agent-summary-title h3 { + margin: 0; + font-size: 13px; +} + +.docker-agent-summary-id { + color: var(--muted); + font: 11px var(--mono); +} + +.docker-agent-summary-badges { + display: flex; + align-items: center; + gap: 8px; +} + +.docker-agent-summary-badges .docker-agent-status-badge { + min-width: 0; + min-height: 0; +} + +.docker-agent-summary-badges .check { + margin-top: 0 !important; +} + +.docker-agent-body { + display: grid; + gap: 10px; +} + +.docker-agent-sections { + grid-template-columns: repeat(2, minmax(0, 1fr)); +} + +.docker-agent-section .docker-agent-grid { + margin-top: 0; + grid-template-columns: repeat(2, minmax(0, 1fr)); +} + +.docker-agent-section .docker-agent-grid>:is(.docker-profile-field, .docker-agent-listener-field, .docker-agent-security, .docker-checkbox-field) { + grid-column: 1 / -1; +} + +.docker-agent-section .docker-agent-security { + margin: 0; +} + +.docker-agent-row .docker-agent-diagnostics:empty { + display: none; +} + +.docker-agent-actions .entity-actions { + display: flex; + gap: 8px; +} + +@media (max-width: 900px) { + .docker-agent-sections, + .docker-agent-section .docker-agent-grid { + grid-template-columns: minmax(0, 1fr); + } + + .docker-agent-summary-row { + grid-template-columns: 12px minmax(0, 1fr) auto; + } + + .docker-agent-summary-endpoint, + .docker-agent-summary-security { + grid-column: 2 / -1; + } +} + +.listener-sections { + margin: 10px 0; +} + +.listener-section .vh-grid { + grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); + gap: 9px; +} + +.listener-section .host-chip-field { + grid-column: 1 / -1; +} + +.listener-section .check { + margin: 0 !important; +} + +.listener-section .listener-protocol-settings-actions { + display: flex; + flex-wrap: wrap; + gap: 6px; + margin-top: 10px; +} + +@media (max-width: 900px) { + .listener-sections { + grid-template-columns: minmax(0, 1fr); + } +} + +/* Help text in agent rows uses the regular help style, not the compact + monospace .entity caption. */ +.docker-agent-row small { + font: 11px/1.45 inherit; + font-family: inherit; + font-size: 11px; + color: var(--muted); +} + +.docker-agent-row .docker-provision summary small { + color: var(--muted); +} + +#docker-agent-settings-list .docker-agent-section .docker-agent-grid>.auto-id-field.auto-id-field { + grid-row: auto; + display: grid; + grid-template-rows: none; + align-content: start; + gap: 6px; +} + +#docker-agent-settings-list .docker-agent-section .docker-agent-grid>.auto-id-field.auto-id-field>span:first-child { + align-self: start; +} + +/* Visual request flows (cache, transformation) and the cache freshness timeline. */ +.settings-page-intro { + margin: 0 0 8px; +} + +.settings-flow { + display: grid; + gap: 10px; + margin: 0 0 var(--ui-gap); + padding: 12px; + border: 1px solid var(--line); + border-radius: var(--rp-radius-surface, 0px); + background: var(--panel2); + container-type: inline-size; +} + +.settings-flow-row { + display: grid; + grid-template-columns: minmax(0, 1fr) repeat(calc(var(--flow-steps, 5) - 1), 18px minmax(0, 1fr)); + align-items: stretch; + gap: 6px; +} + +.settings-flow-step { + display: grid; + align-content: start; + justify-items: start; + gap: 3px; + min-width: 0; + min-height: 0; + padding: 10px; + border: 1px solid var(--line); + border-radius: var(--rp-radius-surface, 0px); + background: var(--panel); + color: var(--text); + font: inherit; + text-align: left; + white-space: normal; +} + +button.settings-flow-step { + cursor: pointer; + height: auto; +} + +button.settings-flow-step:hover, +button.settings-flow-step:focus-visible { + border-color: var(--accent); +} + +.settings-flow-step.is-on { + border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); + box-shadow: inset 0 2px 0 var(--accent); +} + +.settings-flow-step b { + font-size: 13px; + overflow-wrap: anywhere; +} + +.settings-flow-step small { + color: var(--muted); + font-size: 11.5px; + line-height: 1.35; + overflow-wrap: anywhere; +} + +.settings-flow-step .pill { + margin-top: 4px; +} + +.settings-flow-icon { + width: 22px; + height: 22px; + fill: none; + stroke: var(--accent); + stroke-width: 1.6; + stroke-linecap: round; + stroke-linejoin: round; +} + +.settings-flow-arrow { + align-self: center; + justify-self: center; + color: var(--muted); +} + +.settings-flow.is-disabled .settings-flow-step { + opacity: .55; + box-shadow: none; +} + +.settings-flow-legend { + display: flex; + flex-wrap: wrap; + gap: 6px 18px; +} + +.settings-flow-legend-item { + display: flex; + align-items: center; + gap: 6px; + margin: 0; + color: var(--muted); + font-size: 12px; +} + +.settings-flow-disabled { + margin: 0; + color: var(--red); +} + +.settings-flow-disabled[hidden] { + display: none; +} + +.settings-flow-example-tabs { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +.settings-flow-example-tabs button { + min-height: 26px; + padding: 2px 10px; + border: 1px solid var(--line); + background: transparent; + color: var(--muted); + font-size: 11px; +} + +.settings-flow-example-tabs button.active { + border-color: var(--accent); + color: var(--accent); +} + +.settings-flow-example { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 10px; +} + +.settings-flow-example>div { + display: grid; + align-content: start; + gap: 4px; + min-width: 0; +} + +.settings-flow-example pre { + margin: 0; + padding: 8px 10px; + border: 1px solid var(--line); + border-radius: var(--rp-radius-surface, 0px); + background: var(--panel); + font-family: var(--mono); + font-size: 12px; + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +#transform-form .transform-operations-grid { + grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); + gap: 8px; +} + +#transform-form .transform-operations-grid>label.check { + display: grid; + grid-template-columns: auto minmax(0, 1fr); + align-items: center; + gap: 3px 10px; + margin: 0; + padding: 10px 12px; + border: 1px solid var(--line); + border-radius: var(--rp-radius-surface, 0px); + background: var(--panel2); +} + +#transform-form .transform-operations-grid>label.check>span { + font-weight: 600; +} + +#transform-form .switch-help { + grid-column: 2; + margin: 0; + color: var(--muted); + font-size: 12px; + line-height: 1.4; +} + +.settings-timeline { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); + gap: 8px; + margin: 0 0 var(--ui-gap); +} + +.settings-timeline-step { + display: grid; + gap: 3px; + padding: 9px 10px; + border: 1px solid var(--line); + border-left-width: 3px; + border-radius: var(--rp-radius-surface, 0px); + background: var(--panel2); +} + +.settings-timeline-step small { + color: var(--muted); +} + +.settings-timeline-step.is-ok { + border-left-color: var(--green); +} + +.settings-timeline-step.is-warn { + border-left-color: var(--warn-line, var(--accent)); +} + +.settings-timeline-step.is-bad { + border-left-color: var(--red); +} + +@container (max-width: 760px) { + .settings-flow-row { + grid-template-columns: minmax(0, 1fr); + } + + .settings-flow-arrow { + transform: rotate(90deg); + line-height: 1; + } + + .settings-flow-example { + grid-template-columns: minmax(0, 1fr); + } +} + +/* Security page: summary tiles, default-decision cards, policy simulator. */ +.security-summary { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); + gap: 14px; + margin: 0 0 14px; +} + +.security-summary-tile { + display: grid; + align-content: start; + justify-items: start; + gap: 2px; + height: auto; + min-height: 0; + padding: 12px 14px; + border: 1px solid var(--line); + border-left: 3px solid var(--line); + border-radius: var(--rp-radius-surface, 0px); + background: var(--panel); + color: var(--text); + font: inherit; + text-align: left; + white-space: normal; + cursor: pointer; +} + +.security-summary-tile:hover { + border-color: var(--accent); +} + +.security-summary-tile.is-ok { + border-left-color: var(--green); +} + +.security-summary-tile.is-warn { + border-left-color: var(--warn-line, var(--accent)); +} + +.security-summary-tile b { + font-size: 20px; + font-weight: 600; + overflow-wrap: anywhere; +} + +.security-summary-tile span { + font-size: 12.5px; + font-weight: 600; +} + +.security-summary-tile small { + color: var(--muted); + font-size: 11.5px; +} + +#host-policy-form .policy-default-select { + display: none; +} + +#host-policy-form .policy-default-cards { + grid-template-columns: repeat(2, minmax(0, 1fr)); +} + +.acl-simulator { + display: grid; + gap: 8px; + padding: 10px 12px; + border: 1px solid var(--line); + border-radius: var(--rp-radius-surface, 0px); + background: var(--panel2); +} + +.acl-simulator>label { + display: grid; + gap: 4px; + margin: 0; +} + +.acl-simulator-results { + display: grid; +} + +.acl-simulator-row { + display: grid; + grid-template-columns: minmax(110px, auto) minmax(0, 1fr) auto; + align-items: center; + gap: 10px; + padding: 6px 0; + border-top: 1px solid var(--line); +} + +.acl-simulator-row code { + font-family: var(--mono); + font-size: 12px; + overflow-wrap: anywhere; +} + +.acl-simulator-note { + margin: 6px 0 0; +} + +.acl-simulator-error { + margin: 0; + color: var(--red); +} + +@media (max-width: 640px) { + #host-policy-form .policy-default-cards { + grid-template-columns: minmax(0, 1fr); + } + + .acl-simulator-row { + grid-template-columns: minmax(0, 1fr) auto; + } + + .acl-simulator-row .fine { + grid-column: 1 / -1; + grid-row: 2; + } +} + +/* Rules & headers: one card with tabs, like HTTP connections. */ +.policy-settings-card [data-policy-settings-page]>form { + margin-top: 14px; +} diff --git a/src/admin/web/css/55-policy.css b/src/admin/web/css/55-policy.css index ec0c383..4aaa76e 100644 --- a/src/admin/web/css/55-policy.css +++ b/src/admin/web/css/55-policy.css @@ -457,11 +457,7 @@ min-width: 520px; } -/* HTTP policies are nested in the Docker service "Headers" section and use the - same disclosure row as the other Docker service sections. */ -.docker-headers-editor .docker-policy-editor { - margin-top: 12px; -} +/* Docker service "HTTP policies" uses the same disclosure row as the other sections. */ .docker-policy-editor>.http-policy-editor { margin-top: 10px; diff --git a/src/admin/web/css/70-responsive.css b/src/admin/web/css/70-responsive.css index 32761d7..941003d 100644 --- a/src/admin/web/css/70-responsive.css +++ b/src/admin/web/css/70-responsive.css @@ -886,9 +886,17 @@ min-width: 0; } + .backend-table-tools { + position: relative; + } + + .backend-column-picker { + position: static; + } + .backend-column-options { - right: auto; - left: 0; + right: 0; + left: auto; } .vhost-card-head .entity-actions { @@ -1103,7 +1111,6 @@ max-height: calc((calc(55dvh - 230px)) / var(--ui-scale, 1)); } - .page-editor, .h3-editor .vh-grid { grid-template-columns: 1fr 1fr; } @@ -1893,6 +1900,7 @@ .docker-service-editor[open]:not(.docker-service-metrics)>.docker-protocol-editor, .docker-service-editor[open]:not(.docker-service-metrics)>.docker-security-editor, .docker-service-editor[open]:not(.docker-service-metrics)>.docker-diagnostics-editor, +.docker-service-editor[open]:not(.docker-service-metrics)>.docker-policy-editor, .docker-service-editor[open]:not(.docker-service-metrics)>.docker-timeout-editor { margin-top: 10px; } diff --git a/src/admin/web/docker.js b/src/admin/web/docker.js index 99ae1c8..9c1884e 100644 --- a/src/admin/web/docker.js +++ b/src/admin/web/docker.js @@ -169,6 +169,7 @@ const endpoint = row.querySelector(".docker-agent-endpoint")?.value || "", fingerprint = row.querySelector(".docker-agent-fingerprint")?.value || ""; const info = securityInfo({ endpoint, tls_fingerprint_sha256: fingerprint }, null), badge = row.querySelector(".docker-agent-security-badge"); if (badge) { badge.textContent = t(info.key); badge.className = `pill docker-agent-security-badge ${info.cls}`.trim(); } + const summaryBadge = row.querySelector(".docker-agent-summary-security"); if (summaryBadge) { summaryBadge.textContent = t(info.key); summaryBadge.className = `pill docker-agent-summary-security ${info.cls}`.trim(); } const hint = row.querySelector(".docker-agent-security-hint"); if (hint) hint.textContent = info.detail; } @@ -429,7 +430,7 @@ } function agentSettingsRow(agent = null, options = {}) { const value = agent || { id: "", name: "", enabled: true, endpoint: "https://127.0.0.1:9876", token: "", tls_fingerprint_sha256: null, domains: [], poll_interval_seconds: 30, certificate_ids: [], acl_profile_id: null, default_target_ip: null, listener_ids: [firstListener()], assignments: [] }; - const row = el("div", undefined, "docker-agent-settings entity"); row.dataset.originalId = agent?.id || ""; row._assignments = structuredClone(value.assignments || []); + const row = el("details", undefined, "docker-agent-settings entity vh-location docker-agent-row"); row.open = !agent || !!options.provision; row.dataset.originalId = agent?.id || ""; row._assignments = structuredClone(value.assignments || []); const head = el("div", undefined, "card-heading"), title = el("div"), titleText = el("h3", value.name || value.id || t("dockerAgentNew")); title.append(el("span", t("dockerAgent"), "small-label"), titleText); const enabled = input("", "checkbox", "docker-agent-enabled switch"); enabled.checked = value.enabled !== false; const enabledLabel = el("label", undefined, "check"); enabledLabel.append(enabled, el("span", t("enabled"))); @@ -502,21 +503,43 @@ } catch (error) { showBubble(`${t("dockerTestFailed")}: ${error.message}`, "error"); } finally { testButton.disabled = false; } }); - const grid = el("div", undefined, "field-grid docker-agent-grid"); + // Collapsed: one row (state, name/ID, endpoint, transport security, status, Enabled). + // Expanded: provisioning, diagnostics and four sections holding every field. + const section = (number, key, cls) => { const box = el("section", undefined, `location-card docker-agent-section ${cls}`), heading = el("h4", undefined, "location-card-title"), grid = el("div", undefined, "field-grid docker-agent-grid"); heading.append(el("span", number, "location-step"), el("span", t(key))); box.append(heading, grid); return [box, grid]; }; + const [connectionBox, connectionGrid] = section("1", "dockerAgentSectionConnection", "docker-agent-connection"); + const [authBox, authGrid] = section("2", "dockerAgentSectionAuth", "docker-agent-auth"); + const [domainBox, domainGrid] = section("3", "dockerAgentSectionDomains", "docker-agent-domain-section"); + const [publishBox, publishGrid] = section("4", "dockerAgentSectionPublish", "docker-agent-publish"); const idField = labeled("dockerAgentId", id); - grid.append(labeled("dockerAgentName", name), idField, labeled("dockerAgentEndpoint", endpoint, t("dockerAgentEndpointHelp")), labeled("dockerAgentToken", token), labeled("dockerTlsFingerprint", fingerprint, t("dockerTlsFingerprintHelp")), labeled("dockerPollInterval", poll, t("dockerPollIntervalHelp")), domainsField, certificateField, labeled("dockerDefaultTarget", target.node, t("dockerDefaultTargetHelp")), defaultAclField, labelField); - const listenerField = el("div", undefined, "docker-agent-listener-field"); listenerField.append(el("span", t("dockerListeners"), "docker-agent-field-label")); - const listenerControl = window.rustProxyIntegrations.bindings(listenerField, value.listener_ids || [], !agent); listenerField.querySelector(".listener-choices")?.classList.add("docker-agent-listener-choices"); row._readListeners = listenerControl.read; grid.append(listenerField); + connectionGrid.append(labeled("dockerAgentName", name), idField, labeled("dockerAgentEndpoint", endpoint, t("dockerAgentEndpointHelp")), labeled("dockerPollInterval", poll, t("dockerPollIntervalHelp"))); const security = el("div", undefined, "docker-agent-security"), secBadge = el("span", "", "pill docker-agent-security-badge"), secHint = el("span", "", "fine docker-agent-security-hint"); security.append(secBadge, secHint); + authGrid.append(labeled("dockerAgentToken", token), labeled("dockerTlsFingerprint", fingerprint, t("dockerTlsFingerprintHelp")), security); + domainGrid.append(domainsField, certificateField); + const listenerField = el("div", undefined, "docker-agent-listener-field"); listenerField.append(el("span", t("dockerListeners"), "docker-agent-field-label")); + const listenerControl = window.rustProxyIntegrations.bindings(listenerField, value.listener_ids || [], !agent); listenerField.querySelector(".listener-choices")?.classList.add("docker-agent-listener-choices"); row._readListeners = listenerControl.read; + publishGrid.append(listenerField, labeled("dockerDefaultTarget", target.node, t("dockerDefaultTargetHelp")), defaultAclField, labelField); const diagnostics = el("div", undefined, "docker-agent-diagnostics"); diagnostics.dataset.agentId = agent?.id || ""; renderAgentDiagnostics(diagnostics); - endpoint.addEventListener("input", () => updateSecurityBadge(row)); fingerprint.addEventListener("input", () => updateSecurityBadge(row)); row.append(head, provision, diagnostics, security, grid); updateSecurityBadge(row); + const summary = el("summary", undefined, "location-summary docker-agent-summary-row"); + const sumState = el("span", undefined, `loc-state ${state?.ok ? "is-ok" : state ? "is-bad" : "is-unknown"}`), sumTitle = el("span", undefined, "docker-agent-summary-title"), sumEndpoint = el("span", value.endpoint || "-", "loc-path docker-agent-summary-endpoint"), sumSecurity = el("span", "", "pill docker-agent-summary-security"), sumBadges = el("span", undefined, "docker-agent-summary-badges"); + const sumId = el("code", value.id || "", "docker-agent-summary-id"); sumTitle.append(titleText, sumId); + sumBadges.append(stateBadge, enabledLabel); summary.append(sumState, sumTitle, sumEndpoint, sumSecurity, sumBadges); + title.remove(); head.remove(); + const body = el("div", undefined, "location-body docker-agent-body"), sections = el("div", undefined, "location-cards docker-agent-sections"); + sections.append(connectionBox, authBox, domainBox, publishBox); + const footer = el("div", undefined, "redirect-rule-actions docker-agent-actions"); actions.replaceChildren(testWrap, remove); footer.append(actions); + body.append(provision, diagnostics, sections, footer); + row.append(summary, body); + row.addEventListener("invalid", () => { row.open = true; }, true); + const syncSummary = () => { sumEndpoint.textContent = endpoint.value.trim() || "-"; sumId.textContent = id.value.trim(); }; + endpoint.addEventListener("input", () => { updateSecurityBadge(row); syncSummary(); }); fingerprint.addEventListener("input", () => updateSecurityBadge(row)); id.addEventListener("input", syncSummary); updateSecurityBadge(row); window.rustProxyAutoId.attach(id, { elements: [name], taken: () => [...(cfg().agents || []).map(item => item.id), ...[...document.querySelectorAll("#docker-agent-settings-list .docker-agent-id")].filter(node => node !== id).map(node => node.value.trim())].filter(Boolean) }); return row; } function renderSettings() { const target = $("docker-agent-settings-list"); if (!target || !envelope) return; if (settingsDirty.has("docker-agents-form")) { renderSettingsDiagnostics(); return; } - target.replaceChildren(...(cfg().agents || []).map(agent => agentSettingsRow(agent))); if (!target.children.length) target.append(el("p", t("dockerNoAgents"), "empty")); + const openRows = new Set([...target.querySelectorAll(".docker-agent-settings[open]")].map(row => row.dataset.originalId).filter(Boolean)); + target.replaceChildren(...(cfg().agents || []).map(agent => { const row = agentSettingsRow(agent); if (openRows.has(agent.id)) row.open = true; return row; })); if (!target.children.length) target.append(el("p", t("dockerNoAgents"), "empty")); renderAlertSettings(); if (!settingsObservationsRequested && authenticated && (cfg().agents || []).length) { settingsObservationsRequested = true; void refresh(false); } } @@ -875,31 +898,32 @@ basic_auth: collectBasicAuth(row), }; } - // "Headers": diagnostic response headers and the vhost's HTTP policy rules. - // The policy editor stays collapsed inside this section until it is needed. - function headersEditor(assignment, row) { - const details = el("details", undefined, "docker-diagnostics-editor docker-headers-editor"), summary = el("summary"), state = el("small", "", "fine"); - summary.append(el("span", t("dockerHeaders")), state); details.append(summary); + function diagnosticsEditor(assignment) { + const details = el("details", undefined, "docker-diagnostics-editor"), summary = el("summary"), state = el("small", "", "fine"); summary.append(el("span", t("dockerDiagnostics")), state); details.append(summary); const grid = el("div", undefined, "field-grid docker-diagnostics-grid"); const box = (cls, value) => { const node = input("", "checkbox", `${cls} switch`); node.checked = value === true; return node; }; const timing = box("docker-timing-headers", assignment?.timing_headers), backend = box("docker-backend-header", assignment?.backend_header), backendTiming = box("docker-backend-timing-header", assignment?.backend_timing_header); - grid.append(el("h4", t("dockerDiagnostics"), "docker-subheading docker-wide-field"), el("p", t("dockerDiagnosticsHelp"), "fine docker-wide-field"), - checkboxField("vhTimingHeaders", timing), checkboxField("vhBackendHeader", backend), checkboxField("vhBackendTimingHeader", backendTiming)); - const policyBox = el("details", undefined, "docker-policy-editor"), policySummary = el("summary"), policyState = el("small", "", "fine"); - policySummary.append(el("span", t("policyTitle")), policyState); policyBox.append(policySummary); - let sync = () => { }; - const policy = window.rustProxyPolicy.create({ value: assignment?.policy || {}, scope: "vhost", onChange: () => { row.classList.add("is-dirty"); sync(); } }); - policyBox.append(policy.node); row._readPolicy = () => policy.read(); - details.append(grid, policyBox); - let ruleCount = (assignment?.policy?.rules || []).length; - sync = () => { - const rules = policy.node.querySelector(".policy-visual:not([hidden]) .policy-rules"); - if (rules) ruleCount = rules.querySelectorAll(":scope > .policy-rule").length; - const rulesText = ruleCount ? t("dockerPolicyRuleCount").replace("{count}", ruleCount) : t("dockerPolicyNone"); - policyState.textContent = rulesText; + grid.append(checkboxField("vhTimingHeaders", timing), checkboxField("vhBackendHeader", backend), checkboxField("vhBackendTimingHeader", backendTiming)); + details.append(grid); + const sync = () => { const enabled = [[timing, "Server-Timing"], [backend, "X-RustProxy-Backend"], [backendTiming, "X-RustProxy-Backend-Time"]].filter(([control]) => control.checked).map(([, label]) => label); - state.textContent = enabled.length || ruleCount ? [...enabled, ...(ruleCount ? [rulesText] : [])].join(" · ") : t("dockerHeadersHelp"); + state.textContent = enabled.length ? enabled.join(" · ") : t("dockerDiagnosticsHelp"); }; + details.addEventListener("change", sync); sync(); + return details; + } + // HTTP policies: an ordinary Docker service section, like Security or Proxy timeouts. + function policyEditor(assignment, row) { + const details = el("details", undefined, "docker-policy-editor"), summary = el("summary"), state = el("small", "", "fine"); + summary.append(el("span", t("policyTitle")), state); details.append(summary); + let ruleCount = (assignment?.policy?.rules || []).length; + const sync = () => { + const rules = details.querySelector(".policy-visual:not([hidden]) .policy-rules"); + if (rules) ruleCount = rules.querySelectorAll(":scope > .policy-rule").length; + state.textContent = ruleCount ? t("dockerPolicyRuleCount").replace("{count}", ruleCount) : t("dockerPolicyNone"); + }; + const policy = window.rustProxyPolicy.create({ value: assignment?.policy || {}, scope: "vhost", onChange: () => { row.classList.add("is-dirty"); sync(); } }); + details.append(policy.node); row._readPolicy = () => policy.read(); details.addEventListener("input", sync); details.addEventListener("change", sync); sync(); return details; } @@ -1084,7 +1108,7 @@ protocolOptions.append(h1, checkboxField("dockerHttp2Enabled", h2Enabled), checkboxField("dockerHttp3Enabled", h3Enabled)); protocolBox.append(protocolSummary, protocolOptions); route.append(hostField, aliases.node, backendIpSettings, labeled("dockerBackendScheme", scheme), switches); syncHostHelp(); - editor.append(route, protocolBox, aclEditor(assignment, agent), securityEditor(assignment), cacheEditor(assignment, agent, key, cacheEnabled, () => expandedHost(host.value.trim() || technical, domainSelect.value)), headersEditor(assignment, row), timeoutEditor(assignment), healthEditor(assignment), passiveHealthEditor(assignment)); + editor.append(route, protocolBox, aclEditor(assignment, agent), securityEditor(assignment), cacheEditor(assignment, agent, key, cacheEnabled, () => expandedHost(host.value.trim() || technical, domainSelect.value)), diagnosticsEditor(assignment), policyEditor(assignment, row), timeoutEditor(assignment), healthEditor(assignment), passiveHealthEditor(assignment)); const actions = el("div", undefined, "docker-service-actions"); apply = el("button", t("dockerApplyService"), "outline docker-apply"); apply.type = "button"; apply.disabled = !publish.checked; apply.addEventListener("click", async () => { apply.disabled = true; try { await saveAssignment(agent.id, row, true); } catch (error) { toast(error.message, true); } finally { if (row.isConnected) apply.disabled = !publish.checked; } }); actions.append(apply); editor.append(actions); function updateHint() { syncCertificateHint(); editorHint.textContent = hintFor({ hostname: host.value.trim(), domain: domainSelect.value, targetLabel: target.selectedOptions?.[0]?.textContent || t("dockerBackendIpAuto"), scheme: scheme.value, h2: h2Enabled.checked, h3: h3Enabled.checked, aliasCount: aliases.count() }); } updateHint(); for (const control of [host, aliases.input, target, scheme]) { control.addEventListener("input", updateHint); control.addEventListener("change", updateHint); } diff --git a/src/admin/web/host404.js b/src/admin/web/host404.js index 0006d24..a11c48a 100644 --- a/src/admin/web/host404.js +++ b/src/admin/web/host404.js @@ -37,10 +37,41 @@ const h2 = $("notfound-http2"), h3 = $("notfound-http3"); control.onChange(() => { const caps = control.capabilities(); h2.disabled = !caps.http2; h3.disabled = !caps.http3; if (!caps.http2) h2.checked = false; if (!caps.http3) h3.checked = false; }); } + const CLOUDFLARE_KINDS = ["cloudflare", "cloudflare_welcome", "cloudflare_placeholder"]; + const kindGroup = mode => CLOUDFLARE_KINDS.includes(mode) ? "cloudflare" : mode; function syncMode() { const mode = $("notfound-mode").value; populateStatuses(); $("notfound-html-field").hidden = mode !== "html"; + for (const radio of form.querySelectorAll('input[name="notfound-kind"]')) { radio.checked = radio.value === kindGroup(mode); radio.closest(".vh-www-choice").classList.toggle("is-selected", radio.checked); } + $("notfound-variant-field").hidden = !CLOUDFLARE_KINDS.includes(mode); + if (CLOUDFLARE_KINDS.includes(mode)) $("notfound-variant").value = mode; + schedulePreview(); + } + function chooseKind(group) { + const mode = group === "cloudflare" ? (CLOUDFLARE_KINDS.includes($("notfound-variant").value) ? $("notfound-variant").value : "cloudflare") : group; + $("notfound-mode").value = mode; syncMode(); + } + // Preview of the selected page through the sandboxed /api/pages/preview. + let previewTimer = null; + function previewUrl(mode = $("notfound-mode").value, status = $("notfound-status").value, host = editing) { + const params = new URLSearchParams({ kind: mode, status: String(status || 404) }); + if (mode === "html") { if (!host) return ""; params.set("host", host); } + return `/api/pages/preview?${params}`; + } + function schedulePreview() { clearTimeout(previewTimer); previewTimer = setTimeout(updatePreview, 150); } + function updatePreview() { + const frame = $("notfound-preview-frame"), open = $("notfound-preview-open"), note = $("notfound-preview-note"); if (!frame) return; + const mode = $("notfound-mode").value, saved = (envelope?.config.not_found_hosts || []).find(item => item.id === editing); + const savedHtml = saved?.page?.kind === "html" ? saved.page.html : null; + let noteKey = ""; + if (mode === "html" && savedHtml === null) noteKey = "notfoundPreviewHtmlUnsaved"; + else if (mode === "html" && savedHtml !== $("notfound-html").value) noteKey = "notfoundPreviewHtmlSaved"; + else if (mode === "empty") noteKey = "notfoundPreviewEmpty"; + note.hidden = !noteKey; if (noteKey) { note.dataset.i18n = noteKey; note.textContent = t(noteKey); } + const url = mode === "html" && savedHtml === null ? "" : previewUrl(mode); + frame.hidden = !url || !dialog.open; open.hidden = !url; + if (url) { open.href = url; if (frame.dataset.src !== url && dialog.open) { frame.dataset.src = url; frame.src = url; } } } function load(item = defaults()) { editing = item.id || null; revision = envelope?.revision ?? null; dirty = false; @@ -48,14 +79,26 @@ $("notfound-id").value = item.id || ""; $("notfound-id").disabled = Boolean(editing); $("notfound-name").value = item.name || ""; window.rustProxyAutoId.attach($("notfound-id"), { elements: [$("notfound-name")], taken: () => (envelope?.config.not_found_hosts || []).map(value => value.id) }); $("notfound-enabled").checked = item.enabled !== false; syncEnabledControl(); $("notfound-http2").checked = item.http2_enabled !== false; $("notfound-http3").checked = item.http3_enabled !== false; - const hostHolder = $("notfound-hosts-editor"); hostHolder.replaceChildren(); readHosts = window.rustProxyIntegrations.hostnames(hostHolder, item.frontend?.hosts || [], { labelKey: "notfoundHosts", helpKey: "vhHostsHelp", requiredKey: "notfoundHostsRequired", onChange: () => { changed(); notFoundAutoCertificate?.refresh(); } }); + const hostHolder = $("notfound-hosts-editor"); hostHolder.replaceChildren(); readHosts = window.rustProxyIntegrations.hostnames(hostHolder, item.frontend?.hosts || [], { labelKey: "notfoundHosts", helpKey: "vhHostsHelp", requiredKey: "notfoundHostsRequired", onChange: () => { changed(); notFoundAutoCertificate?.refresh(); syncSummary(); } }); listenerChoices(item.frontend?.listener_ids || []); certificateChoices(item.certificate_id); notFoundAutoCertificate = window.rustProxyAutoCertificate.attach($("notfound-certificate"), { auto: !editing, hosts: () => { try { return readHosts(); } catch { return []; } }, certificates: () => envelope?.config.tls?.certificates || [] }); notFoundAutoCertificate.refresh(); - $("notfound-mode").value = item.page?.kind || "welcome"; populateStatuses(item.page?.status ?? 404); $("notfound-html").value = item.page?.html || ""; syncMode(); dialog.showModal(); + $("notfound-mode").value = item.page?.kind || "welcome"; populateStatuses(item.page?.status ?? 404); $("notfound-html").value = item.page?.html || ""; + const frame = $("notfound-preview-frame"); frame.removeAttribute("src"); delete frame.dataset.src; + activateTab("details"); syncSummary(); dialog.showModal(); syncMode(); + } + function activateTab(name) { + for (const node of $("notfound-tabs").querySelectorAll("button[data-tab]")) { const on = node.dataset.tab === name; node.classList.toggle("active", on); node.setAttribute("aria-pressed", String(on)); } + for (const group of $("notfound-fields").querySelectorAll(".vh-group[data-tab]")) group.hidden = group.dataset.tab !== name; + $("notfound-fields").scrollTop = 0; if (name === "response") updatePreview(); + } + const activeTab = () => $("notfound-tabs").querySelector("button.active")?.dataset.tab || "details"; + function syncSummary() { + const hosts = (() => { try { return readHosts(); } catch { return []; } })(); + $("notfound-summary").textContent = [value("notfound-id") || t("notfoundNewLabel"), hosts.join(", ")].filter(Boolean).join(" · "); } function suspendDraft() { const state = { - editing, revision, label: $("notfound-editing").textContent, controls: window.rustProxyDrafts.captureControls(form), + editing, revision, label: $("notfound-editing").textContent, tab: activeTab(), controls: window.rustProxyDrafts.captureControls(form), hosts: window.rustProxyDrafts.takeChildren($("notfound-hosts-editor")), listeners: window.rustProxyDrafts.takeChildren($("notfound-listeners")), readBindings, readHosts }; @@ -64,7 +107,7 @@ function restoreDraft(state) { window.rustProxyDrafts.restoreChildren($("notfound-hosts-editor"), state.hosts); window.rustProxyDrafts.restoreChildren($("notfound-listeners"), state.listeners); readBindings = state.readBindings; readHosts = state.readHosts; editing = state.editing; revision = state.revision; dirty = true; $("notfound-editing").textContent = state.label; - window.rustProxyDrafts.restoreControls(form, state.controls); syncEnabledControl(); syncMode(); if (!dialog.open) dialog.showModal(); + window.rustProxyDrafts.restoreControls(form, state.controls); syncEnabledControl(); syncSummary(); activateTab(state.tab || "details"); if (!dialog.open) dialog.showModal(); syncMode(); } function closeEditor() { if (dirty) return window.rustProxyDrafts.dock("notfound"); if (dialog.open) dialog.close(); return true; } @@ -76,26 +119,47 @@ if (kind === "html" && !html.trim()) throw new Error(t("notfoundHtmlRequired")); return { id, name, enabled: yes("notfound-enabled"), http2_enabled: yes("notfound-http2"), http3_enabled: yes("notfound-http3"), frontend: { hosts, listener_ids }, certificate_id: value("notfound-certificate") || null, page: { kind, status, html: kind === "html" ? html : "" } }; } + const modeKey = kind => `notfoundMode${kind.replace(/(^|_)([a-z])/g, (_, prefix, c) => c.toUpperCase())}`; + function listenerLabel(id) { + const endpoint = (envelope?.config.listeners?.endpoints || []).find(item => item.id === id); + if (!endpoint) return id; + const address = endpoint.binding?.address || ""; + return `${endpoint.binding?.tls ? "HTTPS" : "HTTP"} ${address.replace(/^0\.0\.0\.0|^\[::\]/, "")}`.trim(); + } + async function toggleEnabled(item) { + if (busy) return; + if (item.enabled !== false && !(await appConfirm(t("notfoundDisableConfirm"), { danger: true, confirmLabel: t("redirectDisable") }))) return; + const next = structuredClone(envelope.config.not_found_hosts || []), index = next.findIndex(value => value.id === item.id); if (index < 0) return; + next[index].enabled = item.enabled === false; + if (await saveSection("not-found-hosts", next)) render(); + } function render() { if (!envelope) return; const query = ($("notfound-search").value || "").trim().toLowerCase(); const entries = (envelope.config.not_found_hosts || []).filter(item => !query || [item.id, item.name, ...(item.frontend?.hosts || [])].join(" ").toLowerCase().includes(query)); const sortValue = item => ({ id: String(item.id || "").toLowerCase(), name: String(item.name || item.id || "").toLowerCase(), hostname: String(item.frontend?.hosts?.[0] || "").toLowerCase(), status: Number(item.page?.status ?? 404), mode: String(item.page?.kind || "welcome"), listeners: (item.frontend?.listener_ids || []).join(" ").toLowerCase(), certificate: String(item.certificate_id || "").toLowerCase() }[listPrefs.sort]); entries.sort((left, right) => { const a = sortValue(left), b = sortValue(right); const result = typeof a === "number" && typeof b === "number" ? a - b : compareText(a, b); return listPrefs.descending ? -result : result; }); list.replaceChildren(...entries.map(item => { - const card = el("article", undefined, "vhost-card redirect-card"), head = el("div", undefined, "vhost-card-head"), identity = el("div", undefined, "vhost-card-identity"), title = el("div", undefined, "vhost-title-line"); - title.append(el("strong", item.name || item.id, "entity-title")); if (item.enabled === false) title.append(el("span", t("vhDisabled"), "pill")); identity.append(title); head.append(identity); - const actions = el("div", undefined, "entity-actions"); actions.append(action(t("edit"), () => { window.rustProxyDrafts.prepare(); load(structuredClone(item)); }), action(t("copyEntry"), () => { window.rustProxyDrafts.prepare(); const copy = structuredClone(item); copy.id = ""; copy.name = ""; copy.frontend = { ...(copy.frontend || {}), hosts: [] }; copy.certificate_id = null; load(copy); }), action(t("remove"), async () => { if (busy || !(await appConfirm(t("confirmDelete"), { danger: true }))) return; const next = (envelope.config.not_found_hosts || []).filter(value => value.id !== item.id); if (await saveSection("not-found-hosts", next)) { if (editing === item.id) dialog.close(); render(); } })); head.append(actions); card.append(head); - const flow = el("div", undefined, "redirect-flow"), from = el("div", undefined, "redirect-flow-from"), to = el("div", undefined, "redirect-flow-to"); - for (const host of item.frontend?.hosts || []) from.append(el("span", host, "redirect-host-chip")); - to.append(el("span", `${item.page?.status ?? 404} ${STATUS_NAMES[item.page?.status ?? 404] || ""}`.trim(), "redirect-target"), el("span", t(`notfoundMode${(item.page?.kind || "welcome").replace(/(^|_)([a-z])/g, (_, prefix, c) => c.toUpperCase())}`), "redirect-target-more")); - flow.append(from, el("span", "→", "redirect-flow-arrow"), to); card.append(flow); - const meta = el("div", undefined, "redirect-meta"); - for (const [k, v] of [["redirectListeners", (item.frontend?.listener_ids || []).join(", ") || "-"], ["vhCertificate", item.certificate_id || t("vhCertificateDefault")]]) { const node = el("span", undefined, "redirect-meta-item"); node.append(el("span", t(k)), el("b", v)); meta.append(node); } - card.append(meta); return card; + const card = el("article", undefined, "vhost-card redirect-card notfound-card"), head = el("div", undefined, "vhost-card-head"), identity = el("div", undefined, "vhost-card-identity"), title = el("div", undefined, "vhost-title-line"); + card.dataset.notfoundCard = item.id; + const kind = item.page?.kind || "welcome", status = item.page?.status ?? 404; + title.append(el("strong", item.name || item.id, "entity-title"), el("span", t(item.enabled === false ? "notfoundStateOff" : "notfoundStateOn"), item.enabled === false ? "pill" : "pill live"), el("span", `${status} · ${t(modeKey(kind))}`, kind === "welcome" ? "pill" : "pill warn")); + identity.append(title, el("div", `${item.id} · ${(item.frontend?.hosts || []).join(", ") || "-"}`, "vhost-hosts")); head.append(identity); + const actions = el("div", undefined, "entity-actions"); const toggle = action(t(item.enabled === false ? "redirectEnable" : "redirectDisable"), () => toggleEnabled(item)); if (item.enabled !== false) toggle.classList.add("danger-quiet"); + const preview = el("a", t("notfoundPreview"), "quiet notfound-card-preview"); preview.href = previewUrl(kind, status, item.id); preview.target = "_blank"; preview.rel = "noopener noreferrer"; + actions.append(toggle, action(t("edit"), () => { window.rustProxyDrafts.prepare(); load(structuredClone(item)); }), action(t("copyEntry"), () => { window.rustProxyDrafts.prepare(); const copy = structuredClone(item); copy.id = ""; copy.name = ""; copy.frontend = { ...(copy.frontend || {}), hosts: [] }; copy.certificate_id = null; load(copy); }), action(t("remove"), async () => { if (busy || !(await appConfirm(t("confirmDelete"), { danger: true }))) return; const next = (envelope.config.not_found_hosts || []).filter(value => value.id !== item.id); if (await saveSection("not-found-hosts", next)) { if (editing === item.id) dialog.close(); render(); } })); head.append(actions); card.append(head); + const editButton = [...actions.children].find(node => node.textContent === t("edit")); editButton?.after(preview); + const details = el("div", undefined, "vhost-detail-strip"); + const protocols = ["HTTP/1.1", item.http2_enabled !== false ? "HTTP/2" : "", item.http3_enabled !== false ? "HTTP/3" : ""].filter(Boolean).join(" · "); + for (const [key, shown] of [["redirectListeners", (item.frontend?.listener_ids || []).map(listenerLabel).join(" · ") || "-"], ["vhCertificate", item.certificate_id || t("vhCertificateDefault")], ["notfoundResponseTab", `${status} ${STATUS_NAMES[status] || ""}`.trim()], ["vhProtocols", protocols]]) { const cell = el("div", undefined, "vhost-detail"); cell.append(el("span", t(key), "small-label"), el("b", shown)); details.append(cell); } + card.append(details); return card; })); if (!entries.length) list.append(el("p", t(query ? "notfoundSearchEmpty" : "notfoundEmpty"), "fine")); } form.addEventListener("input", changed); form.addEventListener("change", changed); $("notfound-mode").addEventListener("change", syncMode); $("notfound-status").addEventListener("change", syncMode); + for (const radio of form.querySelectorAll('input[name="notfound-kind"]')) radio.addEventListener("change", () => { if (radio.checked) chooseKind(radio.value); }); + $("notfound-variant").addEventListener("change", () => chooseKind("cloudflare")); $("notfound-html").addEventListener("input", schedulePreview); + for (const tab of $("notfound-tabs").querySelectorAll("button[data-tab]")) tab.addEventListener("click", () => activateTab(tab.dataset.tab)); + $("notfound-id").addEventListener("input", syncSummary); form.addEventListener("submit", async event => { event.preventDefault(); if (!envelope || busy) return; const invalid = [...form.elements].find(input => input.willValidate && !input.checkValidity()); if (invalid) { invalid.reportValidity(); return; } if (revision !== envelope.revision) { toast(t("stale"), true); return; } try { const item = collect(), next = structuredClone(envelope.config.not_found_hosts || []); if (!editing && next.some(value => value.id === item.id)) throw new Error(t("notfoundDuplicate")); const index = next.findIndex(value => value.id === editing); if (index < 0) next.push(item); else next[index] = item; if (await saveSection("not-found-hosts", next)) { dirty = false; editing = item.id; dialog.close(); render(); } } catch (error) { toast(error.message, true); } }); $("notfound-new").addEventListener("click", () => { window.rustProxyDrafts.prepare(); load(); }); $("notfound-search").addEventListener("input", render); $("notfound-sort")?.addEventListener("change", event => { listPrefs.sort = event.target.value; void saveListPrefs(); render(); }); $("notfound-sort-direction")?.addEventListener("click", () => { listPrefs.descending = !listPrefs.descending; syncSortDirection(); void saveListPrefs(); render(); }); $("notfound-close").addEventListener("click", closeEditor); $("notfound-reset").addEventListener("click", async () => { if (await allowDiscard()) load(editing ? structuredClone((envelope?.config.not_found_hosts || []).find(item => item.id === editing) || defaults()) : defaults()); }); dialog.addEventListener("cancel", event => { event.preventDefault(); closeEditor(); }); window.rustProxyDrafts.register("notfound", { labelKey: "notfound", isOpen: () => dialog.open, isDirty: () => dirty, suspend: suspendDraft, restore: restoreDraft, close: () => { dirty = false; if (dialog.open) dialog.close(); } }); diff --git a/src/admin/web/index.html b/src/admin/web/index.html index e40a0e4..f5351da 100644 --- a/src/admin/web/index.html +++ b/src/admin/web/index.html @@ -954,7 +954,7 @@ -
+
+

Accounts and ACLs are global; SSL and + response policies also have per-vhost controls.

+
- + type="button">
+
+ +
+
+
+ Protocols +
+
+ +
+

Local response

+
+ + + + + +
+
+ + + + +
+
+ + + +
+

The host never opens an upstream connection. The + built-in placeholder is no-store and intentionally omits optional RustProxy diagnostic/server + headers.

+
+