v0.38.7
This commit is contained in:
1 parent
d4a604970e
commit
38a23e2210
40 files changed
+928
-532
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
# RustProxy source and documentation maintenance
|
# RustProxy source and documentation maintenance
|
||||||
|
|
||||||
Current source version: **0.38.6**. The Cargo package and binary are named `rust-proxy`.
|
Current source version: **0.38.7**. The Cargo package and binary are named `rust-proxy`.
|
||||||
|
|
||||||
Before editing, read [README.md](README.md), the relevant [documentation guide](docs/README.md) and the actual code and tests. Historical release experiments are not current specifications. Use the bundled `src/admin/openapi.json` for API routes and payloads; the source implementation is authoritative for runtime behavior.
|
Before editing, read [README.md](README.md), the relevant [documentation guide](docs/README.md) and the actual code and tests. Historical release experiments are not current specifications. Use the bundled `src/admin/openapi.json` for API routes and payloads; the source implementation is authoritative for runtime behavior.
|
||||||
|
|
||||||
|
|||||||
+10
-2
@@ -2,11 +2,19 @@
|
|||||||
|
|
||||||
Release history focused on **features, settings, default behavior, compatibility and fixes**. Changes to internal code structure and preliminary performance experiments are intentionally omitted. Historical descriptions reflect their respective releases; consult the current documentation for the settings available in the latest release.
|
Release history focused on **features, settings, default behavior, compatibility and fixes**. Changes to internal code structure and preliminary performance experiments are intentionally omitted. Historical descriptions reflect their respective releases; consult the current documentation for the settings available in the latest release.
|
||||||
|
|
||||||
## Unreleased — Docker agent resource safeguards (0.38.6 source patch)
|
## 0.38.7 — static Vary cookie option and panel consistency
|
||||||
|
|
||||||
|
- **Static `Vary: Cookie` safety (fix):** preserve the origin's `Vary: Cookie` when a public response has zero remaining freshness or requires revalidation. An otherwise storable zero-TTL response must not trigger the static-cookie override; a positive configured fallback TTL still permits it. No configuration or API change.
|
||||||
|
- **Docker backend diagnostic header (formatting fix):** shorten the opt-in `X-Rust-Proxy-Backend` value for Docker publications from `docker-<agent>-<service hash>/docker` to `<agent>/<service hash>` while preserving the agent and 12-character service hash. Internal backend IDs, routing, logs, monitoring, ordinary Vhosts and the header name remain unchanged. No new configuration or version bump.
|
||||||
|
- **Public static asset caching:** added `cache.static_ignore_vary_cookie` (default `true`, Vhost override/inheritance supported), which removes `Cookie` from a qualifying `Vary` response when ignoring static request cookies. Requires an explicitly public and otherwise cacheable response; retains the other Vary fields and rejects private, no-store, Set-Cookie and invalid responses. Only enable it for assets whose entire representation is independent of cookies; the setting is available under Cache → Static & diagnostics and Vhosts → Cache.
|
||||||
|
- **RFC 9111 `Vary` variant matching (fix):** normalize insignificant list whitespace and equivalent repeated field lines for known list-valued request headers; canonicalize case-insensitive `Accept-Language`, `Accept-Encoding`, `Accept-Charset` tokens, equivalent quality weights, and `Accept` media types without folding case-sensitive parameters. Preserve ordering, quoted strings, absent-vs-empty fields, opaque/custom headers, `Cookie` boundaries and `Vary: *` rejection. HOT/COLD now use v2 variant keys; existing v1 disk variants safely miss and refill instead of being reused under new semantics. No config/API or version change.
|
||||||
|
- **Vhost country picker:** Security → Country access uses the same searchable country selector as Settings → Policies, keeping the existing country-code format.
|
||||||
|
- **Certificate generation:** the terms agreement and production issuance confirmations use switches when switch controls are enabled; neither is auto-accepted.
|
||||||
|
**Docker agent safeguards carried forward from the 0.38.6 source patch:**
|
||||||
|
|
||||||
- **Docker-agent memory and connection safety:** reuse pooled Docker API connections (bounded idle and active connections), cap concurrent inventory requests at two (HTTP 503 with `Retry-After: 1`), fetch container details with eight workers and cache them for 15 seconds. Every published port of one container now receives the same CPU, RAM and restart details.
|
- **Docker-agent memory and connection safety:** reuse pooled Docker API connections (bounded idle and active connections), cap concurrent inventory requests at two (HTTP 503 with `Retry-After: 1`), fetch container details with eight workers and cache them for 15 seconds. Every published port of one container now receives the same CPU, RAM and restart details.
|
||||||
- **Safer enrollment and polling:** global constant-memory rate limit for one-time enrollment (burst of six attempts, one refill per second; HTTP 429 with `Retry-After: 1`), shorter collector locks during Docker API/public IP calls, and bounded HTTP read/write timeouts.
|
- **Safer enrollment and polling:** global constant-memory rate limit for one-time enrollment (burst of six attempts, one refill per second; HTTP 429 with `Retry-After: 1`), shorter collector locks during Docker API/public IP calls, and bounded HTTP read/write timeouts.
|
||||||
- **Agent diagnostics:** authenticated on-demand `GET /v1/diagnostics` returns RSS, Go heap allocation, goroutine count and Linux open file descriptor count without exposing process details at `/healthz`. Rebuild and restart the Docker agent to activate this source-only patch; these changes are not part of the original 0.38.6 release.
|
- **Agent diagnostics:** authenticated on-demand `GET /v1/diagnostics` returns RSS, Go heap allocation, goroutine count and Linux open file descriptor count without exposing process details at `/healthz`. Rebuild and restart the Docker agent for these safeguards; the original 0.38.6 binary did not include them.
|
||||||
|
|
||||||
## 0.38.6 — chart crosshair and editor layout
|
## 0.38.6 — chart crosshair and editor layout
|
||||||
|
|
||||||
|
|||||||
Generated
+1
-1
@@ -1943,7 +1943,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-proxy"
|
name = "rust-proxy"
|
||||||
version = "0.38.6"
|
version = "0.38.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rust-proxy"
|
name = "rust-proxy"
|
||||||
version = "0.38.6"
|
version = "0.38.7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.99.1"
|
rust-version = "1.99.1"
|
||||||
description = "RustProxy - independent reverse proxy with local administration"
|
description = "RustProxy - independent reverse proxy with local administration"
|
||||||
|
|||||||
+35
-37
@@ -1,10 +1,10 @@
|
|||||||
61bf40a0572889dc8b0dda9eae4e93e44b0de9364b3c798106c85700ffb37c23 .dockerignore
|
61bf40a0572889dc8b0dda9eae4e93e44b0de9364b3c798106c85700ffb37c23 .dockerignore
|
||||||
4140a2956264b44f259e6a37fc00ba02097bbe68b09296e04d3d243c1287129b .env.example
|
4140a2956264b44f259e6a37fc00ba02097bbe68b09296e04d3d243c1287129b .env.example
|
||||||
e76e688874828e3743d03693b1d2872b9633b4db09909673786caf30f7cfe489 .gitignore
|
e76e688874828e3743d03693b1d2872b9633b4db09909673786caf30f7cfe489 .gitignore
|
||||||
24870f4e9eb3c0b77cc77a2646f8b713d74ca3af4fd402884fd5280d7f69fac5 AGENTS.md
|
91975a03be79d1daaa117781f363f21c7383db18b2079099dc9196b7481f8ca4 AGENTS.md
|
||||||
e83dff9939d80015f2e00eed4142e49351f58ec1f84df3615aea76e09fe47abb CHANGELOG.md
|
e5c39b233d89ee97f4f97c3f6739745a148f8a620c25d19f6dabfa18ee08ee53 CHANGELOG.md
|
||||||
27f94902638412bb5284cbe81947f58cc5c7d7b980d3b9f5fdbfcb3d496d3eff Cargo.lock
|
da73d9b3e2d274d7832bdb7057f52f0927ad34ffa7b06cf246aeacf3760a2f2e Cargo.lock
|
||||||
6b436bc11426cdf717e65e1284e9be5438143cfd3ae2ce4d64ce5bbd4228a67a Cargo.toml
|
e5bbc39fb1a3a7c0db48fa9be7a8edfd3382810a47c5e2aaa0765e5a92f2946c Cargo.toml
|
||||||
788745d4f70a0382c6280020afbd48844bb2af65e835a826852143f8132cdeca Dockerfile
|
788745d4f70a0382c6280020afbd48844bb2af65e835a826852143f8132cdeca Dockerfile
|
||||||
0d96a4ff68ad6d4b6f1f30f713b18d5184912ba8dd389f86aa7710db079abcb0 LICENSE
|
0d96a4ff68ad6d4b6f1f30f713b18d5184912ba8dd389f86aa7710db079abcb0 LICENSE
|
||||||
82d1dee2fc68158f0ea73259151461e64c8b18d807cd1fecfb1ed99dc30cf5f4 README.md
|
82d1dee2fc68158f0ea73259151461e64c8b18d807cd1fecfb1ed99dc30cf5f4 README.md
|
||||||
@@ -23,41 +23,39 @@ b3fe278c181abaa4e83d0743923740ce4449faffa9a1ab2c2fe9c185e9b955bf docker-agent/d
|
|||||||
6ad4958e72e96e1623b396ba47e6c5f7dc2effe6244833030fbe769ca3ae4e02 docker-agent/disk_other.go
|
6ad4958e72e96e1623b396ba47e6c5f7dc2effe6244833030fbe769ca3ae4e02 docker-agent/disk_other.go
|
||||||
86f1259a7619f5d19500d833e515d67376464851878a84dd2a677350fd2344d6 docker-agent/docker-agent.env.example
|
86f1259a7619f5d19500d833e515d67376464851878a84dd2a677350fd2344d6 docker-agent/docker-agent.env.example
|
||||||
29021c42bc4f22fd6c0b7fcd0263fd170ea1c070584affbdcb80e4e3510e47b1 docker-agent/docker.go
|
29021c42bc4f22fd6c0b7fcd0263fd170ea1c070584affbdcb80e4e3510e47b1 docker-agent/docker.go
|
||||||
29b7dbbc096aa2db58dfd430933bb72a683856c9b0736f0f92ad57f49f52a9a4 docker-agent/docker_transport_test.go
|
|
||||||
6b7c90bca93c5e61c4c555ca373dc5bdaa5df172f4ab583b291557f3e7364c06 docker-agent/enroll.go
|
6b7c90bca93c5e61c4c555ca373dc5bdaa5df172f4ab583b291557f3e7364c06 docker-agent/enroll.go
|
||||||
10a2b07617f0fb68e63adc1a03db035d24e564a23244310407056bb76715762f docker-agent/enroll_test.go
|
10a2b07617f0fb68e63adc1a03db035d24e564a23244310407056bb76715762f docker-agent/enroll_test.go
|
||||||
9e9f3f17f38f9b0730f598f65988ce8ef562d2182ef6778fc7292b990e9cf22f docker-agent/go.mod
|
9e9f3f17f38f9b0730f598f65988ce8ef562d2182ef6778fc7292b990e9cf22f docker-agent/go.mod
|
||||||
b849d39e94878c5a754c3d109d8e4b5e37609cfd2a0e05601a35271f4d95271e docker-agent/install.sh
|
b849d39e94878c5a754c3d109d8e4b5e37609cfd2a0e05601a35271f4d95271e docker-agent/install.sh
|
||||||
314a3a8d2c7677e8e25725247b62c4d094e95416aec1ffd6cbf54251904cc1da docker-agent/main.go
|
314a3a8d2c7677e8e25725247b62c4d094e95416aec1ffd6cbf54251904cc1da docker-agent/main.go
|
||||||
d660f46f7ef8c539dd3f5486a31d5a1254b9737be8a278c7f9352c254558f8ac docker-agent/main_test.go
|
d660f46f7ef8c539dd3f5486a31d5a1254b9737be8a278c7f9352c254558f8ac docker-agent/main_test.go
|
||||||
6f1a3fb2518e028ed0f98352fea6c19f3ec3efd4071fc1d3ec074936a55a521c docker-agent/model.go
|
d3ceee01252c1b7280a7f0d38828def899c3e3baeb62c27c7946fac23918c7f7 docker-agent/model.go
|
||||||
1d13a7930bebc3e60033a7fd7e0b609b2c62ee03bb17ea5add07e91ef8d268ae docker-agent/network.go
|
1d13a7930bebc3e60033a7fd7e0b609b2c62ee03bb17ea5add07e91ef8d268ae docker-agent/network.go
|
||||||
6e2e13136fd8198c2d64dfd0612dfc91c4a9c0a952e71b3b24c9614a72b083aa docker-agent/network_proc_test.go
|
6e2e13136fd8198c2d64dfd0612dfc91c4a9c0a952e71b3b24c9614a72b083aa docker-agent/network_proc_test.go
|
||||||
021e0799a95a7c76bc245ff464d94b4495ce0d22555ca202579bd5f45e4be794 docker-agent/provision.go
|
021e0799a95a7c76bc245ff464d94b4495ce0d22555ca202579bd5f45e4be794 docker-agent/provision.go
|
||||||
651425164237977908f05722b6c85cf0a224c343365c9c17123931c8f035c5a9 docker-agent/resource_limits_test.go
|
|
||||||
4a737e5922c2255492c85d5afc053cd15d9e5b83cada648369cfdeeecdbfaa92 docker-agent/runtime.go
|
4a737e5922c2255492c85d5afc053cd15d9e5b83cada648369cfdeeecdbfaa92 docker-agent/runtime.go
|
||||||
4e64abc321d4149a4982e2acb091c1b2c6fd3584693935b115c837d480ac87a9 docker-agent/rustproxy-docker-agent.service
|
4e64abc321d4149a4982e2acb091c1b2c6fd3584693935b115c837d480ac87a9 docker-agent/rustproxy-docker-agent.service
|
||||||
f30c895df3d7f289f3b7c9a73969009ecf91110f59cb247daa242f68e78aa014 docker-agent/server.go
|
f30c895df3d7f289f3b7c9a73969009ecf91110f59cb247daa242f68e78aa014 docker-agent/server.go
|
||||||
20313df0c14a1696d099ed881b159fe854e92538a60548a1729f92babaead881 docker-agent/system.go
|
20313df0c14a1696d099ed881b159fe854e92538a60548a1729f92babaead881 docker-agent/system.go
|
||||||
188b74ec4f58da1b46d86925a67b6a590c92fb4fd7516e8d03d43871bc3b4542 docker-agent/system_test.go
|
188b74ec4f58da1b46d86925a67b6a590c92fb4fd7516e8d03d43871bc3b4542 docker-agent/system_test.go
|
||||||
c0940a4b323d71931cf2ad4ad24d58b6d6bfd49af90c6e3fc91fcbe2b4cf312f docs/ACCESS.md
|
c0940a4b323d71931cf2ad4ad24d58b6d6bfd49af90c6e3fc91fcbe2b4cf312f docs/ACCESS.md
|
||||||
2b73d0088c5a8da84efd22de2c952c806321013a532b25b0635e61e26b318d8a docs/API.md
|
2c81d5cbd2bc763783e47d4d972263f00d55bda2d06b2e0257a779d969c5c11e docs/API.md
|
||||||
728b15b9825f547f34c4121219784798dd046fbbdd72ece8906d0cd77e8efc64 docs/BACKUP.md
|
728b15b9825f547f34c4121219784798dd046fbbdd72ece8906d0cd77e8efc64 docs/BACKUP.md
|
||||||
c588cc5a6abc907c975492274acf135191f6ce9f3b548c5a19b80c656c2deb1b docs/CACHE.md
|
67d4340c4124971dac7edba35a436b4ff843510b6bd064d685e27af972267af2 docs/CACHE.md
|
||||||
375241ef87cff34c0bda5b771ee474a402f24ae8fb00e97f601b1a5060690508 docs/CERTIFICATES.md
|
a64f72b95918c24938aa7268ec0a534cb0f28dd1ee0aa325b02c49f3347ccf54 docs/CERTIFICATES.md
|
||||||
6aa83366ad45227d10ebe121ed2c4f690ebcb826939ec2b2eafb40bfd714ac69 docs/CONFIGURATION.md
|
6aa83366ad45227d10ebe121ed2c4f690ebcb826939ec2b2eafb40bfd714ac69 docs/CONFIGURATION.md
|
||||||
fec29ce846d6705eb45819d85d382f28e28a146b265feab2e4c7cce2a35e5883 docs/CUSTOM_LOCATIONS.md
|
fec29ce846d6705eb45819d85d382f28e28a146b265feab2e4c7cce2a35e5883 docs/CUSTOM_LOCATIONS.md
|
||||||
2f3e005ab01bb48b6a2d74dd8f163159f892d08c35d9ad7162e912e1d4def870 docs/DASHBOARD.md
|
2f3e005ab01bb48b6a2d74dd8f163159f892d08c35d9ad7162e912e1d4def870 docs/DASHBOARD.md
|
||||||
cc313eee35b651670366e7e07ac3b5fe81c2dd662c0b369afdd7527dde2ed44c docs/DOCKER_DISCOVERY.md
|
402fd12c8d404c469f2df390e8da96c97ac2f498d92f8fc5d82830d763aa3570 docs/DOCKER_DISCOVERY.md
|
||||||
580804db72b91ae8a25002e83a4d93a96cfc46e0a22bfa16a4ce4218cd11431c docs/FEATURES.md
|
84d0ec89445d85c78e690513763bf2a7d16347d67680e0936a85473ed756e31d docs/FEATURES.md
|
||||||
9a66e48a8e8a94e6d37bb71afe1242d10a11df7b6f9d3bf65839e7e14199a38f docs/HEADLESS.md
|
f5835144cd2802abbcac3a36c76bdd4ec2f25fa49307facb199efec5bf9e92d3 docs/HEADLESS.md
|
||||||
4282602f0b814841f71282040003bec91c24611e5152b33407b76e62357f8d3a docs/INSTALL.md
|
4282602f0b814841f71282040003bec91c24611e5152b33407b76e62357f8d3a docs/INSTALL.md
|
||||||
6e37859bf0dced99d4a7db93790cb38fcd90191932827946d5223eaa4c784fce docs/LOGS.md
|
6e37859bf0dced99d4a7db93790cb38fcd90191932827946d5223eaa4c784fce docs/LOGS.md
|
||||||
0e9ae9509a78d00951d2c7c3f13eaf518d1f3448a29b048f5933e1f5f8440275 docs/MIGRATION.md
|
0e9ae9509a78d00951d2c7c3f13eaf518d1f3448a29b048f5933e1f5f8440275 docs/MIGRATION.md
|
||||||
a7717c4ab03417914805527e573ea1dfd5d35295bf7b347d0c098bda6d469850 docs/MONITORING.md
|
a7717c4ab03417914805527e573ea1dfd5d35295bf7b347d0c098bda6d469850 docs/MONITORING.md
|
||||||
6d3937088eeb67a9f690d44ebe0b6e660b68116dbf69091ac7816bdc52cec2b6 docs/PERFORMANCE.md
|
6d3937088eeb67a9f690d44ebe0b6e660b68116dbf69091ac7816bdc52cec2b6 docs/PERFORMANCE.md
|
||||||
d5894c07c68ec4230987767198434abee13b0e525842fea21bcbe752fa82742b docs/PHP_FPM.md
|
d5894c07c68ec4230987767198434abee13b0e525842fea21bcbe752fa82742b docs/PHP_FPM.md
|
||||||
992586a67db492bb5af0dcf78fe067790f6c95b475d39a9f5bd07f05a1390046 docs/README.md
|
856269fc0098b9a40297b5d26731fd5e81079342e7d27eedee2a08acda9e0f39 docs/README.md
|
||||||
490a6dbe870f2b1fd4ec7816768dde6c86fa7957fc9de2d2f075e123c9222222 docs/RESPONSE_DELIVERY.md
|
490a6dbe870f2b1fd4ec7816768dde6c86fa7957fc9de2d2f075e123c9222222 docs/RESPONSE_DELIVERY.md
|
||||||
95ab4786792d5920a2e109b7d196838057f24b512a69d713fb5884dc75c84339 docs/SCREENSHOTS.md
|
95ab4786792d5920a2e109b7d196838057f24b512a69d713fb5884dc75c84339 docs/SCREENSHOTS.md
|
||||||
3a48184b36d225757fc5e2d22c629f89bfe5d4007ff087f0be0ce02a5fb04c28 docs/SECURITY.md
|
3a48184b36d225757fc5e2d22c629f89bfe5d4007ff087f0be0ce02a5fb04c28 docs/SECURITY.md
|
||||||
@@ -65,7 +63,7 @@ bbef60ff1771da9f48af812987766e1e479408873ae2f079b13f1d5c62ecc6ff docs/STREAMS.m
|
|||||||
c9c9a0b401f0565f15b834d855bfdb34edb3eab46bff03d9e0825af204d20bf8 docs/TODO.md
|
c9c9a0b401f0565f15b834d855bfdb34edb3eab46bff03d9e0825af204d20bf8 docs/TODO.md
|
||||||
978097cf53314ad573583d7176491d984b9dbb22295df2b00168a28b14184c4a docs/TRANSPORT.md
|
978097cf53314ad573583d7176491d984b9dbb22295df2b00168a28b14184c4a docs/TRANSPORT.md
|
||||||
be6e8af62a7bf958b94ec15e9e3263263e511d1d33abae4e45d114833fa52b07 docs/TROUBLESHOOTING.md
|
be6e8af62a7bf958b94ec15e9e3263263e511d1d33abae4e45d114833fa52b07 docs/TROUBLESHOOTING.md
|
||||||
c8483143f91e42f81cebdf3cf0b46fa68a6b9d20f0142a4d3e957eeb0d7e495b docs/VHOSTS.md
|
5c74f08d01a59dd7fa0fd4fcca4432d80e98487ec70a09f10583e4658979054c docs/VHOSTS.md
|
||||||
e67928a9d044e71b681c3e52f9dd8b151d6b72f965d16d5da8b0eadde98b70e9 docs/WEB_SERVER.md
|
e67928a9d044e71b681c3e52f9dd8b151d6b72f965d16d5da8b0eadde98b70e9 docs/WEB_SERVER.md
|
||||||
42822b1c9801bcadb0e2d785cb91883ca2df1da141222631f153030c95f5e197 docs/images/about.png
|
42822b1c9801bcadb0e2d785cb91883ca2df1da141222631f153030c95f5e197 docs/images/about.png
|
||||||
deff2393a987ac7102179dc85b48baf2c4a3882291bb8c7c584d760cc497c631 docs/images/api.png
|
deff2393a987ac7102179dc85b48baf2c4a3882291bb8c7c584d760cc497c631 docs/images/api.png
|
||||||
@@ -107,12 +105,12 @@ c720a4426d7b4dc52048077157dd05aefa427ae78ca811afc3b7b9cbbe875cae grafana/rustpr
|
|||||||
e9cbb0224c4a3d23a6019ba557e0cd568c1ad5e1582ff1e335fb7d99b7a1055d integrations/routeros-oci-build/.gitignore
|
e9cbb0224c4a3d23a6019ba557e0cd568c1ad5e1582ff1e335fb7d99b7a1055d integrations/routeros-oci-build/.gitignore
|
||||||
14025f0cad10e1b89f366977123e4cebb68ae59df892d4eed29b6171e63ae908 integrations/routeros-oci-build/Dockerfile.routeros
|
14025f0cad10e1b89f366977123e4cebb68ae59df892d4eed29b6171e63ae908 integrations/routeros-oci-build/Dockerfile.routeros
|
||||||
7c7a3e51f43b43e1c962a4b0bb591f99c1f06977bf77f23719f7f867dfe7eb8e integrations/routeros-oci-build/Dockerfile.routeros.dockerignore
|
7c7a3e51f43b43e1c962a4b0bb591f99c1f06977bf77f23719f7f867dfe7eb8e integrations/routeros-oci-build/Dockerfile.routeros.dockerignore
|
||||||
88ea1985a379900188433fde0a2b55aef16a677ed9d9507d8eee50e6c39f9f87 integrations/routeros-oci-build/README.md
|
3cc5b108c39ca450bdaf59be979622fda41b9ef134914d172eb76f1eb30a959b integrations/routeros-oci-build/README.md
|
||||||
3f092a9ab80221eddd67be4d1a776acbc6e04c1eb6011b588280c28e83b2582f integrations/routeros-oci-build/build-routeros-oci.sh
|
3f092a9ab80221eddd67be4d1a776acbc6e04c1eb6011b588280c28e83b2582f integrations/routeros-oci-build/build-routeros-oci.sh
|
||||||
3f267cafa16006e5456ade78ee2d5fae02cc7ce747839523068ffd8d7c98798a integrations/routeros-oci-build/docker-entrypoint.sh
|
3f267cafa16006e5456ade78ee2d5fae02cc7ce747839523068ffd8d7c98798a integrations/routeros-oci-build/docker-entrypoint.sh
|
||||||
ae2ee2887fcba096d0de25edcc18faa1ffec35759274518db1bf6d6982f7176c langs/README.md
|
ae2ee2887fcba096d0de25edcc18faa1ffec35759274518db1bf6d6982f7176c langs/README.md
|
||||||
f62d1a04d435704c21fc2c07c78c5031587b691774287e97a40039ec0d306a59 langs/en_US.json
|
1dad7ea129ec7a78c15e1210407d13fe5ae6710313868f1221c9544a37234d66 langs/en_US.json
|
||||||
2250f1a3bbb9f53a31705c9bb604a9b32786edb0e4f873222815757ba3b83f2b langs/pl_pl.json
|
13756f27d5d2fb77ca3e41338993f04e3d0ed7d58f8cc5b5f98e1d30568508db langs/pl_pl.json
|
||||||
8ed80f14633970899d56f4ea72684a8d4b1f2843c1c78bfacc4cbb5f7ce9ef4b make_zip.py
|
8ed80f14633970899d56f4ea72684a8d4b1f2843c1c78bfacc4cbb5f7ce9ef4b make_zip.py
|
||||||
e830d37dd1f81a4b0aa7d535f5bba69e34e433b0fd99cc8ee0b296786c32379a migrations/0002_admin.sql
|
e830d37dd1f81a4b0aa7d535f5bba69e34e433b0fd99cc8ee0b296786c32379a migrations/0002_admin.sql
|
||||||
20112cc82192098b8d602f1c4f7ca08712e9e1366c845fabb92753187c370d35 migrations/0003_certificate_renewals.sql
|
20112cc82192098b8d602f1c4f7ca08712e9e1366c845fabb92753187c370d35 migrations/0003_certificate_renewals.sql
|
||||||
@@ -186,7 +184,7 @@ d58a2ed83319176de4e66790ed292447c9497ae031464ec55cfe27174acb639a src/admin/file
|
|||||||
77b8c05645969834cc8a58e249a7b60a57d6c47ad1c5cd92ffa5e4a9b5a8e73c src/admin/file_logs_query.rs
|
77b8c05645969834cc8a58e249a7b60a57d6c47ad1c5cd92ffa5e4a9b5a8e73c src/admin/file_logs_query.rs
|
||||||
13f885b119b79c44cba69c67bdda5a69670d3179472487379edd0a05199486fa src/admin/logging_api.rs
|
13f885b119b79c44cba69c67bdda5a69670d3179472487379edd0a05199486fa src/admin/logging_api.rs
|
||||||
51228956c33358278ebed62941da273e1e87d0b5c5d1c40cc0d2c91aec9d7362 src/admin/mod.rs
|
51228956c33358278ebed62941da273e1e87d0b5c5d1c40cc0d2c91aec9d7362 src/admin/mod.rs
|
||||||
88c00365e1530ce201143aeae16d337cd3129c16fc8fdb7032ac83e782e46d4f src/admin/openapi.json
|
dd1ed3f82da04c746063583a48243675f534c93297bc362a37b229fb6d2c0960 src/admin/openapi.json
|
||||||
f7a356109786635dd58cba590c71c796dbf36b47f25845190c75ee5c6a9fcb86 src/admin/operations.rs
|
f7a356109786635dd58cba590c71c796dbf36b47f25845190c75ee5c6a9fcb86 src/admin/operations.rs
|
||||||
257d93a29d0bda96462bcf695aba8d0ec0f9412c379e066ec46ae8ee034e3a53 src/admin/panel_assets.rs
|
257d93a29d0bda96462bcf695aba8d0ec0f9412c379e066ec46ae8ee034e3a53 src/admin/panel_assets.rs
|
||||||
f5127855c2994d052678865df36d703b74f4a0afc633daf7718b10da18d26e37 src/admin/panel_content.rs
|
f5127855c2994d052678865df36d703b74f4a0afc633daf7718b10da18d26e37 src/admin/panel_content.rs
|
||||||
@@ -231,7 +229,7 @@ b0930110e4eb7de6826e27b5b46c47e46556449fed6dc505d42da4f5e9c20366 src/admin/web/
|
|||||||
3b8e566d81a5b94ef21c73e7805ae128454f085554de9358040de266bcbdb0e0 src/admin/web/app/refresh.js
|
3b8e566d81a5b94ef21c73e7805ae128454f085554de9358040de266bcbdb0e0 src/admin/web/app/refresh.js
|
||||||
14176caf91a5eaea548fca298b316c85aff614a5ef7de9ccac820ba1c018ef3f src/admin/web/app/runtime.js
|
14176caf91a5eaea548fca298b316c85aff614a5ef7de9ccac820ba1c018ef3f src/admin/web/app/runtime.js
|
||||||
31201586925e6f4792071d7d03fb05dcc4a69a03c02a4e85eb0746f45af68074 src/admin/web/app/session-resume.js
|
31201586925e6f4792071d7d03fb05dcc4a69a03c02a4e85eb0746f45af68074 src/admin/web/app/session-resume.js
|
||||||
8f2d9b0f14143cf4b48de4a87d924362dd89dab82638f598278cb11df2675f9e src/admin/web/app/settings.js
|
65e46879e94f13e8271d4105246f29d820903fe68b9efe2dbe4a4ff661ca9dfc src/admin/web/app/settings.js
|
||||||
2281f06990f86acd3ff12fa368e1b73e4c83601e20245f24abbce389dfccb77f src/admin/web/app/sidebar.js
|
2281f06990f86acd3ff12fa368e1b73e4c83601e20245f24abbce389dfccb77f src/admin/web/app/sidebar.js
|
||||||
b7ead49224a4ec67181d3f24f9d9634bd6d76756f826a4d5d993300637d1d8f3 src/admin/web/app/stream-dashboard.js
|
b7ead49224a4ec67181d3f24f9d9634bd6d76756f826a4d5d993300637d1d8f3 src/admin/web/app/stream-dashboard.js
|
||||||
7de070cc8cdde45d7e0932259299e341e25b32c9ffbd87e4fcce934d0f090de4 src/admin/web/app/web-overview.js
|
7de070cc8cdde45d7e0932259299e341e25b32c9ffbd87e4fcce934d0f090de4 src/admin/web/app/web-overview.js
|
||||||
@@ -273,7 +271,7 @@ e6c4d91d1542d0a5b47bb8736f9539d43a6713df5a473b635519d5b7eac2eb9c src/admin/web/
|
|||||||
0a5fff35555153f59d4346933030a67b6e1a8768cee7a47cfa2fcf1a2c564f63 src/admin/web/favicon.svg
|
0a5fff35555153f59d4346933030a67b6e1a8768cee7a47cfa2fcf1a2c564f63 src/admin/web/favicon.svg
|
||||||
1430936eef78ab81db57e8e9273dd0bc7d3398c8cad39acede051852d9a728f4 src/admin/web/file-logs.js
|
1430936eef78ab81db57e8e9273dd0bc7d3398c8cad39acede051852d9a728f4 src/admin/web/file-logs.js
|
||||||
85f54ce519140a38e31fb1b3d5974585748d7162f0499aa63703c1db56334b2c src/admin/web/host404.js
|
85f54ce519140a38e31fb1b3d5974585748d7162f0499aa63703c1db56334b2c src/admin/web/host404.js
|
||||||
cf7795b5b9d4b4741b7e382ae0068429b6fbb8efa2470140565a57e3144dd275 src/admin/web/index.html
|
4709e030dcca1b3ed93b291b379d94157a3c5ea2dc637caba39842ab5552b611 src/admin/web/index.html
|
||||||
c5cc91382ddcf47dcff9f422ef2f94c1ebe45362c14f119c1a55b582d71443c7 src/admin/web/integrations.js
|
c5cc91382ddcf47dcff9f422ef2f94c1ebe45362c14f119c1a55b582d71443c7 src/admin/web/integrations.js
|
||||||
7a12f020fc587205694978ab41b660e9a80487d413fbf6e34fc525eabc58308f src/admin/web/login-keys.json
|
7a12f020fc587205694978ab41b660e9a80487d413fbf6e34fc525eabc58308f src/admin/web/login-keys.json
|
||||||
ac9f667273918e18406df06cb2613c923f50a88897693a03a18f500e22dc6ec2 src/admin/web/login.html
|
ac9f667273918e18406df06cb2613c923f50a88897693a03a18f500e22dc6ec2 src/admin/web/login.html
|
||||||
@@ -290,8 +288,8 @@ b2d4b67fb65c55003e516e23dd783de55b0f00278035f16589f156a4659b7a54 src/admin/web/
|
|||||||
12db5600c14cadbbbe7676b170b058e9695108d2661d9cd6b61fe91d355ac731 src/admin/web/tls-configurator.js
|
12db5600c14cadbbbe7676b170b058e9695108d2661d9cd6b61fe91d355ac731 src/admin/web/tls-configurator.js
|
||||||
dd697c7c46e40da006b61220a90ed9579c3c08c1484a96dc746314d5b4c4f3ea src/admin/web/traffic-panel.js
|
dd697c7c46e40da006b61220a90ed9579c3c08c1484a96dc746314d5b4c4f3ea src/admin/web/traffic-panel.js
|
||||||
675ea169d4cc55fda5e291af536338b882bede1eaa6c9d5cc7dfde0779c7c4d1 src/admin/web/transform-panel.js
|
675ea169d4cc55fda5e291af536338b882bede1eaa6c9d5cc7dfde0779c7c4d1 src/admin/web/transform-panel.js
|
||||||
2148f1c5fe3b516c550e88ac81c55058e1cb17c77b646e8c35652d630177d0a2 src/admin/web/vhosts/core.js
|
a49da8cd65b1db4a96ff6a4f101629d3ed036798d5f14f5d8297036fb7f6c75a src/admin/web/vhosts/core.js
|
||||||
6bcd927141137f557dd037a455959aef5fff5425061793e76f072fdcd1e90811 src/admin/web/vhosts/editor.js
|
8484f15cbdf97d038c498657973ba7913ad57aaf84f90c18d4c6ff73b42be967 src/admin/web/vhosts/editor.js
|
||||||
3776f72d7051af86ac5fbdd4581040dd88a424c0c6cde789301b032b159094d8 src/admin/web/vhosts/health.js
|
3776f72d7051af86ac5fbdd4581040dd88a424c0c6cde789301b032b159094d8 src/admin/web/vhosts/health.js
|
||||||
b3239e67901f1796d7a974ade0796f2e3590ff8064628a5629b78c7f6ce2f32e src/admin/web/vhosts/protocol.js
|
b3239e67901f1796d7a974ade0796f2e3590ff8064628a5629b78c7f6ce2f32e src/admin/web/vhosts/protocol.js
|
||||||
8c3da49973c62333559b0e3588c02beb0b425c025eac5cfa82a1bb968f70d9dd src/admin/web/vhosts/rates.js
|
8c3da49973c62333559b0e3588c02beb0b425c025eac5cfa82a1bb968f70d9dd src/admin/web/vhosts/rates.js
|
||||||
@@ -328,10 +326,10 @@ d789bf40cf9433e2fd16409d112210fe93154588b1ac9bddc9c7f78e1db14426 src/balance/po
|
|||||||
a361c341932ffd186c0b21356c91ab1fe8043f5020d40798266d15ae896a114e src/balance/tests.rs
|
a361c341932ffd186c0b21356c91ab1fe8043f5020d40798266d15ae896a114e src/balance/tests.rs
|
||||||
ae06d238b1451328c751a511476ef39c012f3a397393f939ca02f96ecd0119a6 src/basic_auth/mod.rs
|
ae06d238b1451328c751a511476ef39c012f3a397393f939ca02f96ecd0119a6 src/basic_auth/mod.rs
|
||||||
9a8858b7ff461a4d961ba701ca3ed6eaec15c3f7f05eef8e0e30edc63617605a src/basic_auth/tests.rs
|
9a8858b7ff461a4d961ba701ca3ed6eaec15c3f7f05eef8e0e30edc63617605a src/basic_auth/tests.rs
|
||||||
9a7c0d0e5bcad1c7efdf2a4621346a340abf1b7b82902d2655267da4b8131be7 src/cache/cache_regression_tests.rs
|
3ea2e11fa1f3af55f8937dae17ff5a50c5ec841a42420163c20d32fb2ff85ec9 src/cache/cache_regression_tests.rs
|
||||||
7def03ace07dc38a4806277d75b6ce673d33ddaaf1c4855fa0a3372be1cf9489 src/cache/cold.rs
|
7def03ace07dc38a4806277d75b6ce673d33ddaaf1c4855fa0a3372be1cf9489 src/cache/cold.rs
|
||||||
b75ff512a1c6344483e00d2c67578ceea6b5472c279da0246f3622daa68d7e16 src/cache/cold/cleanup.rs
|
b75ff512a1c6344483e00d2c67578ceea6b5472c279da0246f3622daa68d7e16 src/cache/cold/cleanup.rs
|
||||||
5fde9e9f77277d557372e4614264512804192bb51f3d2eae785988c17b2e7253 src/cache/cold/cold_tier_tests.rs
|
640a0f11bf3c77e44f276ba300bdb645465621b2015a32e215e416faaaf65b18 src/cache/cold/cold_tier_tests.rs
|
||||||
3c3897980c31a69d96f9295689d1ae19f2190da758c69ee7a0541f4171288bb8 src/cache/cold/demotion.rs
|
3c3897980c31a69d96f9295689d1ae19f2190da758c69ee7a0541f4171288bb8 src/cache/cold/demotion.rs
|
||||||
17b2a157b03f43f49ed05f1f3391aef025a453b748056c67229cb3ceaa53bb7a src/cache/cold/startup.rs
|
17b2a157b03f43f49ed05f1f3391aef025a453b748056c67229cb3ceaa53bb7a src/cache/cold/startup.rs
|
||||||
83095bc93132f306c537b31ba929669fedac99af3c4f133d0533b5ed7ac4e6ed src/cache/cold/worker.rs
|
83095bc93132f306c537b31ba929669fedac99af3c4f133d0533b5ed7ac4e6ed src/cache/cold/worker.rs
|
||||||
@@ -353,14 +351,14 @@ e9c6ab0c2be9f96573f826e6a1b9e4c2b8b526f779e72e95a6463ae07e45ab55 src/cache/look
|
|||||||
0c8b0d550e94d4474dcdf991aa0340228dc5f2f904f39350e6e666a16f16fe87 src/cache/model.rs
|
0c8b0d550e94d4474dcdf991aa0340228dc5f2f904f39350e6e666a16f16fe87 src/cache/model.rs
|
||||||
b96e30ef2b12ad7647915457f087a4d11b6141847bc5e971a75c2739c88c3d8c src/cache/model/cache.rs
|
b96e30ef2b12ad7647915457f087a4d11b6141847bc5e971a75c2739c88c3d8c src/cache/model/cache.rs
|
||||||
0ec4f6d0adea1ed80a3ca17c68c9c85502491da2904d9d690b4169ab9b025b21 src/cache/model/cold_metadata.rs
|
0ec4f6d0adea1ed80a3ca17c68c9c85502491da2904d9d690b4169ab9b025b21 src/cache/model/cold_metadata.rs
|
||||||
81abb9e4dfb7d602e0651df6be979b5bd10ef019a1f3ba1db19aab3945c81889 src/cache/model/entry.rs
|
d5dc6f28d81c8124694dc259611060d64eda405e452954d2c0ddf019d60374ab src/cache/model/entry.rs
|
||||||
ff1c3a1a3bc0d26218dcc943ef951c2a212c180bbf6e4bf1c542ffbf12a9f150 src/cache/model/http_invalidation.rs
|
ff1c3a1a3bc0d26218dcc943ef951c2a212c180bbf6e4bf1c542ffbf12a9f150 src/cache/model/http_invalidation.rs
|
||||||
ee9508498d420a726abee1d12ca21fd5117c1908ff53c2ce29f01de4380f26ac src/cache/model/maintenance.rs
|
7f2b43560eaa30bb8faf56659aaf3d59fdf5f84407122dfedc2a55bd1e699f2e src/cache/model/maintenance.rs
|
||||||
fdce2dc7f85dca23620ca3a8d445cfea3fec842a65545ea8d3c25fdf6635ffde src/cache/model/settings.rs
|
37649cf245c90813ba1f25f80bdd261cb7ab31e2c19dd537234513edb4974251 src/cache/model/settings.rs
|
||||||
14f3f8ae5252a2dc13fcf9556523ffb945b77ee92a5fb4939cd27e113fc61660 src/cache/model/views.rs
|
14f3f8ae5252a2dc13fcf9556523ffb945b77ee92a5fb4939cd27e113fc61660 src/cache/model/views.rs
|
||||||
e26dce02df9c043329ca164fed215d271781bce8fb03240f528331bf3df6b9d7 src/cache/policy.rs
|
e26dce02df9c043329ca164fed215d271781bce8fb03240f528331bf3df6b9d7 src/cache/policy.rs
|
||||||
70c255e15f2b8c030988a2263b0e07b5c16e7e26770c72becbcec6da4550fcd9 src/cache/policy/request.rs
|
70c255e15f2b8c030988a2263b0e07b5c16e7e26770c72becbcec6da4550fcd9 src/cache/policy/request.rs
|
||||||
b3b05b291922834dfe170c5961f6c395d9209c3904111834a70d8aca2468f803 src/cache/policy/response.rs
|
90360ed4b91736e02644aa64bacd92cfba10d8f657be5282eeb8f45f933a1781 src/cache/policy/response.rs
|
||||||
12a6d5d9d6711e956391b4b952e8149658b8bf64cfcc0a4c59c281f2630a6aac src/cache/policy/scope_tests.rs
|
12a6d5d9d6711e956391b4b952e8149658b8bf64cfcc0a4c59c281f2630a6aac src/cache/policy/scope_tests.rs
|
||||||
c3a4300f7cdb6b2b7c16fbc489d49ba2451331bb4a55a2d9f618c684fd61eecb src/cache/range.rs
|
c3a4300f7cdb6b2b7c16fbc489d49ba2451331bb4a55a2d9f618c684fd61eecb src/cache/range.rs
|
||||||
a97558fb3f91d3b1d986004ea31b183d8cfb85f73cb212a3e1e6b9441a3d423a src/cache/rules.rs
|
a97558fb3f91d3b1d986004ea31b183d8cfb85f73cb212a3e1e6b9441a3d423a src/cache/rules.rs
|
||||||
@@ -454,24 +452,24 @@ f8a9541b568ade946dfc0b3353548a773a0126f705b537815ce0523439b07ef4 src/prometheus
|
|||||||
f1b0254f53b1a4336bd8170ad441ba072b49a114e497b985cb20699b4e375044 src/prometheus/web_php.rs
|
f1b0254f53b1a4336bd8170ad441ba072b49a114e497b985cb20699b4e375044 src/prometheus/web_php.rs
|
||||||
6afc4e87591afb7327d61de441e6bbe70e0645575830272473dff441fa6bb077 src/proxy/body/mod.rs
|
6afc4e87591afb7327d61de441e6bbe70e0645575830272473dff441fa6bb077 src/proxy/body/mod.rs
|
||||||
5beeac12ca7f041bdb9b74b2dbc9781f5d5524fcf51294b8b6ad88284754ef20 src/proxy/body/tests.rs
|
5beeac12ca7f041bdb9b74b2dbc9781f5d5524fcf51294b8b6ad88284754ef20 src/proxy/body/tests.rs
|
||||||
8c10568ad79ddfb97e64ee95cdb6b581f9e42eef7b3b4fdbbfa603e8c24de32b src/proxy/cache_helpers.rs
|
c03cdfa8da7bb440d08ce4436e8bedaaf8dad5e489169e6bc156495029e12ad5 src/proxy/cache_helpers.rs
|
||||||
2d39552aa01ce3d048560944975243d0a58ae762d838e547f5fa65007d871dc4 src/proxy/cache_http_invalidation.rs
|
2d39552aa01ce3d048560944975243d0a58ae762d838e547f5fa65007d871dc4 src/proxy/cache_http_invalidation.rs
|
||||||
a86b10ce0707b51e925e11ea14f7f40fa108a196166f62cf40007a97f9e17203 src/proxy/cache_http_invalidation_tests.rs
|
a86b10ce0707b51e925e11ea14f7f40fa108a196166f62cf40007a97f9e17203 src/proxy/cache_http_invalidation_tests.rs
|
||||||
df239d37b008691d54e257626009684310e6e3712e777094b8450579d56f732f src/proxy/cache_plan/mod.rs
|
df239d37b008691d54e257626009684310e6e3712e777094b8450579d56f732f src/proxy/cache_plan/mod.rs
|
||||||
811a00b55b24638b4bf8a6bea9ed7c0ffe2a758f76bfe63a95e1d31bce1c2c9c src/proxy/cache_plan/tests.rs
|
811a00b55b24638b4bf8a6bea9ed7c0ffe2a758f76bfe63a95e1d31bce1c2c9c src/proxy/cache_plan/tests.rs
|
||||||
d6bd4aafab7b1371c31b3d22ddf949a08ea942489649ca12c7615b3b2d5a109a src/proxy/error_fallback.rs
|
d6bd4aafab7b1371c31b3d22ddf949a08ea942489649ca12c7615b3b2d5a109a src/proxy/error_fallback.rs
|
||||||
6ec51fb45e04047b028052e11dd213d3ab77b563ef24be50e20185a9a2e206db src/proxy/forward/cache_fast_path_tests.rs
|
79ec6b6e378ecfe478ed779ba53e69030c4d5f06ebd6ae0092f335751db0667f src/proxy/forward/cache_fast_path_tests.rs
|
||||||
016bb2719511df1fc5c70256fd7d917b95e9b4ee6044c205537472737b1f6089 src/proxy/forward/cache_lookup.rs
|
016bb2719511df1fc5c70256fd7d917b95e9b4ee6044c205537472737b1f6089 src/proxy/forward/cache_lookup.rs
|
||||||
287012c81144d8f15af4a148ce3ca911d431bc59adff44e697567561aa372bb3 src/proxy/forward/h3_navigation_tests.rs
|
287012c81144d8f15af4a148ce3ca911d431bc59adff44e697567561aa372bb3 src/proxy/forward/h3_navigation_tests.rs
|
||||||
a2a097852d126851fc7191c2fda65764dc842745ad657b970399c1f906caf114 src/proxy/forward/response.rs
|
a2a097852d126851fc7191c2fda65764dc842745ad657b970399c1f906caf114 src/proxy/forward/response.rs
|
||||||
7ade7fe7642c38ccab876cf260e7363ed30f4e9987bd3b98ee97384e5592a6ec src/proxy/forward/route_cache.rs
|
7ade7fe7642c38ccab876cf260e7363ed30f4e9987bd3b98ee97384e5592a6ec src/proxy/forward/route_cache.rs
|
||||||
bb3c264772dd246521145a7d0fa538b1a34e1abe906cb69c7348e5d97c98ccae src/proxy/forward/success_finish.rs
|
affc2d69b026d0a0d3895670c58b4ee1767567ca4a4c4000058d4304695ebad5 src/proxy/forward/success_finish.rs
|
||||||
3c10a4a582d22bbc3ee9bbcfddc2d670cf20d97ad9394608afd4d4fc968af0e4 src/proxy/forward/success_prepare.rs
|
c16a806a2083eecf418cebe0f30e916166355cffe83652df4c2d970981738e0f src/proxy/forward/success_prepare.rs
|
||||||
c965dba1d2639b338f3f3cfc17f760786a30abab708dfb7920ea3bc94d4d734b src/proxy/forward/upstream.rs
|
c965dba1d2639b338f3f3cfc17f760786a30abab708dfb7920ea3bc94d4d734b src/proxy/forward/upstream.rs
|
||||||
5d72200f3b5308215b7a3d7b1f910932eaa4712f9e2954afdfbe2f252e2a2d3c src/proxy/forward/web_source.rs
|
9cc1b71a86d98fbc24ce7abeb5c2a8353510267947963be74ad83312a5f7f297 src/proxy/forward/web_source.rs
|
||||||
e41c2b327175374bfdcb78108bd4eb73e15830b669b2130b6d2edff6c40c2577 src/proxy/forward_entry.rs
|
e41c2b327175374bfdcb78108bd4eb73e15830b669b2130b6d2edff6c40c2577 src/proxy/forward_entry.rs
|
||||||
9b25f5e3ea4443a63ee6f45d12e1957dd316fe8e85325fc00ea416faaab1025a src/proxy/h2_graceful.rs
|
9b25f5e3ea4443a63ee6f45d12e1957dd316fe8e85325fc00ea416faaab1025a src/proxy/h2_graceful.rs
|
||||||
30057732c35c369740a176f7da285e35a4157571a04328f6c6f1494d4ec8550b src/proxy/headers/authority_tests.rs
|
fc61c3f81d0bd8d91dab2a72267d497404e45e10e5cfc6000af16a254f888148 src/proxy/headers/authority_tests.rs
|
||||||
e87437ccf80e50e0159d204dfdd1f8dc0739b6e375be192fce0af749810258cf src/proxy/headers/mod.rs
|
e87437ccf80e50e0159d204dfdd1f8dc0739b6e375be192fce0af749810258cf src/proxy/headers/mod.rs
|
||||||
af9b044761a56e8a6dc57f9d760b289ff4a6bf37db11dbfcd3ec4da5b8f426b6 src/proxy/headers/tests.rs
|
af9b044761a56e8a6dc57f9d760b289ff4a6bf37db11dbfcd3ec4da5b8f426b6 src/proxy/headers/tests.rs
|
||||||
2bc63579975387c92a9459a9677b4a49e76df382b1ee19de12c8341a3ead57e8 src/proxy/identity.rs
|
2bc63579975387c92a9459a9677b4a49e76df382b1ee19de12c8341a3ead57e8 src/proxy/identity.rs
|
||||||
@@ -481,7 +479,7 @@ de1763b89d98607e20f0f6e3c9b546483927cbe5450efc2e5634fe691fd52ad6 src/proxy/requ
|
|||||||
78bbc1263bcd600527bf71acdf5af92bf186267a9084b076d1f75ad6492df659 src/proxy/request_id/tests.rs
|
78bbc1263bcd600527bf71acdf5af92bf186267a9084b076d1f75ad6492df659 src/proxy/request_id/tests.rs
|
||||||
6a00700dc04f30bb1134cce5e0b66347923f7c766f31b3d5e63159cd719e5f16 src/proxy/types.rs
|
6a00700dc04f30bb1134cce5e0b66347923f7c766f31b3d5e63159cd719e5f16 src/proxy/types.rs
|
||||||
e44430c54038a7dc26f327b5d7085e965241da2ffef42c1526ebfc5168981f72 src/proxy/upstream_helpers.rs
|
e44430c54038a7dc26f327b5d7085e965241da2ffef42c1526ebfc5168981f72 src/proxy/upstream_helpers.rs
|
||||||
c3887e344249ce492862c365896731127b7b6fc51bbfda274d7e7aad3a70be0c src/proxy/web_cache_revalidation/mod.rs
|
96d18a85beb9d9492f4d0690eefd9afad9c1c4eabc36f41b447b81861a92ed2a src/proxy/web_cache_revalidation/mod.rs
|
||||||
5522456cc85948228250feac92308d53b130c4a7af98d24f669aca4dfe6999b6 src/proxy/web_cache_revalidation/tests.rs
|
5522456cc85948228250feac92308d53b130c4a7af98d24f669aca4dfe6999b6 src/proxy/web_cache_revalidation/tests.rs
|
||||||
3d591201595a3b1e928ded20a8736477a47e5acc3bcbde158f7c17547ce155ba src/proxy/websocket.rs
|
3d591201595a3b1e928ded20a8736477a47e5acc3bcbde158f7c17547ce155ba src/proxy/websocket.rs
|
||||||
aa58bacc35458ac615680e774a235191f80abf0db978b68095571fce94c2b502 src/proxy/websocket/handshake.rs
|
aa58bacc35458ac615680e774a235191f80abf0db978b68095571fce94c2b502 src/proxy/websocket/handshake.rs
|
||||||
@@ -599,7 +597,7 @@ f00743af2cf4a5952caef7a1dcf68e7817b5599a252a9973e1c22045517c0b0e tests/fixtures
|
|||||||
102b83171a6429b6375d8001d6c5294702385cd58ee55727cb657b1f3566e877 tests/panel_icons_browser.py
|
102b83171a6429b6375d8001d6c5294702385cd58ee55727cb657b1f3566e877 tests/panel_icons_browser.py
|
||||||
c4030b7d224553312012b1f25153dd3545e83de7bccff2894c0e8f7e0e84b721 tests/panel_icons_contract.js
|
c4030b7d224553312012b1f25153dd3545e83de7bccff2894c0e8f7e0e84b721 tests/panel_icons_contract.js
|
||||||
02affd4839f177f07738500820c2a7c05086aa6d536c5fed9daaa1a7411bb667 tests/panel_interface_contract.py
|
02affd4839f177f07738500820c2a7c05086aa6d536c5fed9daaa1a7411bb667 tests/panel_interface_contract.py
|
||||||
a84f188a0ed074f164874f60d7f01a338caa7a2362f0ba9dcd2d97aa81e2dd2b tests/panel_refresh_contract.js
|
47d51872ee62d1f0c4d010bdf55fdfda6997b4297c19b4484d653bd4300e2441 tests/panel_refresh_contract.js
|
||||||
e24a0f84f1bfc46964df865ac387d651f7b384d781cbc8f3a9a5b0b60f3d69ca tests/vhost_auth_selection.js
|
e24a0f84f1bfc46964df865ac387d651f7b384d781cbc8f3a9a5b0b60f3d69ca tests/vhost_auth_selection.js
|
||||||
cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 third_party/swagger-ui-5.33.1/LICENSE
|
cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 third_party/swagger-ui-5.33.1/LICENSE
|
||||||
0d20d1adef18aee3f40dd258172155521ce702ac445cb5f7b7d60ed32dad2fb2 third_party/swagger-ui-5.33.1/NOTICE
|
0d20d1adef18aee3f40dd258172155521ce702ac445cb5f7b7d60ed32dad2fb2 third_party/swagger-ui-5.33.1/NOTICE
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
var version = "0.38.6" // overridden by the package builder using -ldflags -X main.version
|
var version = "0.38.7" // overridden by the package builder using -ldflags -X main.version
|
||||||
|
|
||||||
type config struct {
|
type config struct {
|
||||||
Listen string
|
Listen string
|
||||||
|
|||||||
@@ -162,3 +162,7 @@ X-RustProxy-Certificate-Key: <key-id>
|
|||||||
```
|
```
|
||||||
|
|
||||||
The credential can be used only for allowed certificate reload/deploy operations, not configuration, users, metrics or secret management. Non-loopback use requires the appropriate administration HTTPS security boundary. Rotate broad or legacy credentials. See [Certificates](CERTIFICATES.md).
|
The credential can be used only for allowed certificate reload/deploy operations, not configuration, users, metrics or secret management. Non-loopback use requires the appropriate administration HTTPS security boundary. Rotate broad or legacy credentials. See [Certificates](CERTIFICATES.md).
|
||||||
|
|
||||||
|
## Static cache Vary controls
|
||||||
|
|
||||||
|
The global `cache.static_ignore_vary_cookie` boolean defaults to `true` and can be overridden per Vhost by `cache.static_ignore_vary_cookie` (`null` inherits). This option works only with `static_ignore_cookies` and configured static extensions. For otherwise cacheable, explicitly `public` responses, RustProxy removes `Cookie` from `Vary`, preserving all other Vary dimensions; Set-Cookie, private and no-store responses are not eligible. Use only for responses independent of Cookie. Details are in [Cache](CACHE.md#cache-controls-in-settings).
|
||||||
+12
-2
@@ -5,7 +5,17 @@ RustProxy provides an optional shared HTTP response cache with a bounded in-memo
|
|||||||
### Cache controls in Settings
|
### Cache controls in Settings
|
||||||
|
|
||||||
The **Rules** subtab holds the conditional cache rules described in [Cache rules (VCL-style)](#cache-rules-vcl-style).
|
The **Rules** subtab holds the conditional cache rules described in [Cache rules (VCL-style)](#cache-rules-vcl-style).
|
||||||
The static-extension cookie-bypass warning sits with its extension list, separate from **Cache response headers** options. Only enable this optimization for files whose bytes do not depend on the user's session. `Cookie` can then be omitted from the shared cache key for the configured extensions; responses with `Set-Cookie`, `private`, `no-store` or `Vary: Cookie` remain uncacheable.
|
The **Static & diagnostics** subtab provides **Ignore request cookies for static files** (`cache.static_ignore_cookies`, on by default) and **Ignore Vary: Cookie for public static assets** (`cache.static_ignore_vary_cookie`, on by default), plus the allowed extensions (`cache.static_extensions`). Both options are effective only on the configured file extensions and work together: the request Cookie is excluded from the cache key, and a qualifying backend `Vary: Cookie` is removed from the stored and delivered response. Other Vary dimensions (such as `Accept-Language` or `Accept-Encoding`) remain intact. A vhost may override either option independently, or inherit the global values.
|
||||||
|
|
||||||
|
**Safety requirement:** use both options only when the complete static response (body **and headers**) is identical for all visitors regardless of Cookie. `Vary: Cookie` is a declaration that content may vary, so overriding it on a genuinely session-dependent file can expose one user's cached variant to another. RustProxy applies this override only to responses with an explicit `Cache-Control: public` directive, positive remaining freshness (without mandatory revalidation) and no `Set-Cookie`, `private`, `no-store` or invalid Vary. A zero-TTL response, including `public` with no configured fallback TTL, retains `Vary: Cookie` even if it can be stored for later revalidation. If the response is not cacheable, `Vary: Cookie` is passed through unchanged. Do not enable this optimization for user-specific downloads, generated PDFs, account JSON, or any path where Flask or another origin changes content according to a session cookie; prefer removing the needless `Vary: Cookie` at the origin where possible.
|
||||||
|
|
||||||
|
## `Vary` matching (RFC 9111 §4.1)
|
||||||
|
|
||||||
|
Cached variants use the response's `Vary` field names together with the original request's nominated fields. Reuse requires a match in **every** retained `Vary` dimension; `Vary: *` is never reusable. An absent request field is not equivalent to a present but empty field.
|
||||||
|
|
||||||
|
To avoid unnecessary variants, RustProxy normalizes optional whitespace around commas, joins repeated header lines **only** for known comma-list fields, and preserves quoted strings. For valid `Accept-Language`, `Accept-Encoding` and `Accept-Charset` values it also normalizes case-insensitive tokens and equivalent `q` weights (`q=1` and an omitted weight are equivalent). `Accept` media type/subtype casing is normalized without changing case-sensitive parameter values. List order remains intact; values of `Cookie`, `User-Agent` and other opaque/custom fields are not parsed or reordered. Unsupported or malformed values fall back to conservative bytewise matching (aside from outer HTTP whitespace). This is **deliberately limited semantic normalization**, not a promise to reinterpret every possible extension header.
|
||||||
|
|
||||||
|
The corrected key algorithm uses a new internal variant-key domain. On upgrading an existing installation to the updated **0.38.7** sources, previously persisted COLD variants keyed by the older algorithm will miss and be repopulated; unvaried cached responses do not change. These cold misses are intentional to avoid unsafe cross-version reuse. No configuration changes or cache clearing are required.
|
||||||
|
|
||||||
## Enable caching safely
|
## Enable caching safely
|
||||||
|
|
||||||
@@ -77,7 +87,7 @@ In **Vhosts → Cache**, overrides for static extensions, bypass path prefixes a
|
|||||||
|
|
||||||
- Reuse is scoped by frontend scheme, Host, exact client URL, Vhost/content policy and eligible `Vary` dimensions. HTTP and HTTPS objects do not cross-share.
|
- Reuse is scoped by frontend scheme, Host, exact client URL, Vhost/content policy and eligible `Vary` dimensions. HTTP and HTTPS objects do not cross-share.
|
||||||
- GET and suitable HEAD requests may reuse a full object; changing request methods do not silently invalidate all cached GET results.
|
- GET and suitable HEAD requests may reuse a full object; changing request methods do not silently invalidate all cached GET results.
|
||||||
- Authorization, dynamic cookies, `Set-Cookie`, sticky-affinity cookies, Tinyauth and other private signals normally cause **BYPASS**. A limited static-file cookie exception exists for configured static extensions and does not override `private`, `no-store`, `Set-Cookie` or `Vary: Cookie`.
|
- Authorization, dynamic cookies, `Set-Cookie`, sticky-affinity cookies, Tinyauth and other private signals normally cause **BYPASS**. The static-extension exception may ignore `Vary: Cookie` only if the explicitly public response is otherwise safe to store and the global/vhost option is on. It never overrides `private`, `no-store` or `Set-Cookie`; the origin must guarantee that the complete asset response is not session-dependent.
|
||||||
- Origin status, response size, TTL, unsupported metadata, range/conditional semantics and request/client cache directives can prevent fill or require validation.
|
- Origin status, response size, TTL, unsupported metadata, range/conditional semantics and request/client cache directives can prevent fill or require validation.
|
||||||
- A Web Service selected as a Vhost source uses the same cache policy for eligible local files. File changes can be checked with `ETag` / `Last-Modified`; a 304 validation may refresh a stored body without downloading it again.
|
- A Web Service selected as a Vhost source uses the same cache policy for eligible local files. File changes can be checked with `ETag` / `Last-Modified`; a 304 validation may refresh a stored body without downloading it again.
|
||||||
|
|
||||||
|
|||||||
@@ -108,3 +108,7 @@ The tab lists the existing keys first: permission badge (*reload only* or *deplo
|
|||||||
- **SNI field does not auto-fill:** check the read status below the paths, grant access to the public certificate, then use **Read names from certificate**. A manually edited/cleared field is intentionally preserved until this explicit action; a certificate without DNS SAN entries supplies no names.
|
- **SNI field does not auto-fill:** check the read status below the paths, grant access to the public certificate, then use **Read names from certificate**. A manually edited/cleared field is intentionally preserved until this explicit action; a certificate without DNS SAN entries supplies no names.
|
||||||
|
|
||||||
Keep a private encrypted application backup and a separate copy of any external certificate/key material. See [Backup and recovery](BACKUP.md) and [Security](SECURITY.md).
|
Keep a private encrypted application backup and a separate copy of any external certificate/key material. See [Backup and recovery](BACKUP.md) and [Security](SECURITY.md).
|
||||||
|
|
||||||
|
## Generate form confirmations
|
||||||
|
|
||||||
|
In **Certificates → Generate**, **Sign SOA discovery query** (RFC 2136), **I accept the Let's Encrypt subscriber agreement**, and **I confirm production issuance** use the same on/off switch presentation as other settings when **Settings → Appearance → Show on/off settings as switches** is enabled. The agreement and production confirmations remain required for applicable submissions; changing their appearance does not auto-confirm anything.
|
||||||
@@ -150,7 +150,7 @@ In **Docker vhosts**, select the service and set:
|
|||||||
| **Force HTTPS / WebSockets** | Enable only when needed and when the right frontend listeners exist. |
|
| **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, tester, *Ignore global cache rules*); 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.
|
| **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, tester, *Ignore global cache rules*); 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. |
|
| **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. |
|
||||||
| **Diagnostic headers** | `Server-Timing`, the selected backend (`X-Rust-Proxy-Backend`) and the backend time, for testing; keep them off in production. Stored as `timing_headers`, `backend_header`, `backend_timing_header`. |
|
| **Diagnostic headers** | `Server-Timing`, the selected backend (`X-Rust-Proxy-Backend`) and the backend time, for testing; keep them off in production. For Docker publications the backend header uses `<agent-id>/<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`. |
|
||||||
| **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. |
|
| **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
|
### HTTP Basic Auth for Docker apps
|
||||||
|
|||||||
+2
-2
@@ -52,7 +52,7 @@ RustProxy is a single service that combines a reverse proxy, a static/PHP web se
|
|||||||
## Access and security
|
## Access and security
|
||||||
|
|
||||||
- IP/CIDR and DNS/DDNS allow/deny rules, reusable ACL profiles (up to eight per Vhost).
|
- IP/CIDR and DNS/DDNS allow/deny rules, reusable ACL profiles (up to eight per Vhost).
|
||||||
- Country allow/deny lists with automatic GeoIP database updates.
|
- Country allow/deny lists with automatic GeoIP database updates and a searchable country picker in global and Vhost security settings.
|
||||||
- Request rate limiting per Vhost and globally, with burst and `Retry-After`.
|
- Request rate limiting per Vhost and globally, with burst and `Retry-After`.
|
||||||
- HTTP method policy, request Content-Type denylist and User-Agent blocking.
|
- HTTP method policy, request Content-Type denylist and User-Agent blocking.
|
||||||
- Security headers: HSTS, CSP, X-Frame-Options, Referrer-Policy, Permissions-Policy, `nosniff`.
|
- Security headers: HSTS, CSP, X-Frame-Options, Referrer-Policy, Permissions-Policy, `nosniff`.
|
||||||
@@ -64,7 +64,7 @@ RustProxy is a single service that combines a reverse proxy, a static/PHP web se
|
|||||||
## Cache and delivery
|
## Cache and delivery
|
||||||
|
|
||||||
- Shared HTTP cache with a memory tier (HOT) and an optional disk tier (COLD).
|
- Shared HTTP cache with a memory tier (HOT) and an optional disk tier (COLD).
|
||||||
- RFC 9111 freshness, validators and `Vary`; stale-while-revalidate, stale-if-error and request coalescing.
|
- RFC 9111 freshness, validators and `Vary` with conservative header-aware normalization (known comma-list fields, language/encoding/charset qualities and media types), while preserving opaque values and quoted strings; stale-while-revalidate, stale-if-error and request coalescing. Configurable static-extension exception for cookie-independent assets: omit `Vary: Cookie` only for explicitly public cacheable responses, preserving all other Vary dimensions.
|
||||||
- Varnish-compatible policy option, forced caching rules and per-location cache switches.
|
- Varnish-compatible policy option, forced caching rules and per-location cache switches.
|
||||||
- Graphical [cache rules](CACHE.md#cache-rules-vcl-style) in the spirit of VCL (bypass, cookies, query parameters, cache-key variants, TTL/grace, headers) per vhost and globally, with a request tester and VCL import.
|
- Graphical [cache rules](CACHE.md#cache-rules-vcl-style) in the spirit of VCL (bypass, cookies, query parameters, cache-key variants, TTL/grace, headers) per vhost and globally, with a request tester and VCL import.
|
||||||
- RFC 9211 `Cache-Status` and optional `X-Cache` diagnostics.
|
- RFC 9211 `Cache-Status` and optional `X-Cache` diagnostics.
|
||||||
|
|||||||
+1
-1
@@ -196,7 +196,7 @@ In a container, mount the file read-only (RustProxy never writes it) and keep `/
|
|||||||
`GET /healthz` on `--health-listen` answers `200` while every vhost with backends has at least one healthy backend and `503` otherwise:
|
`GET /healthz` on `--health-listen` answers `200` while every vhost with backends has at least one healthy backend and `503` otherwise:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{"status":"ok","mode":"headless","version":"0.38.6","revision":4,"uptime_seconds":120,
|
{"status":"ok","mode":"headless","version":"0.38.7","revision":4,"uptime_seconds":120,
|
||||||
"last_reload":{"ok":true,"at_unix":1794743660,"error":null},
|
"last_reload":{"ok":true,"at_unix":1794743660,"error":null},
|
||||||
"vhosts_without_healthy_backends":[],
|
"vhosts_without_healthy_backends":[],
|
||||||
"pools":[{"vhost":"app","healthy":3,"backends":3}]}
|
"pools":[{"vhost":"app","healthy":3,"backends":3}]}
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ Guides for operating RustProxy: installation, publishing services, security, cer
|
|||||||
|
|
||||||
## Performance and delivery
|
## Performance and delivery
|
||||||
|
|
||||||
- [Cache](CACHE.md) — HOT (memory) and COLD (disk) cache, freshness, `Cache-Status` and invalidation.
|
- [Cache](CACHE.md) — HOT/COLD cache, RFC 9111 `Vary` matching/normalization, safe static-asset cookie exceptions, freshness, `Cache-Status` and invalidation.
|
||||||
- [Response delivery](RESPONSE_DELIVERY.md) — compression, transformations and response headers.
|
- [Response delivery](RESPONSE_DELIVERY.md) — compression, transformations and response headers.
|
||||||
|
|
||||||
## Operations
|
## Operations
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ image/*
|
|||||||
|
|
||||||
Check with `curl -i -H 'Content-Type: multipart/form-data; boundary=test' --data 'x' https://your-vhost.example/upload` (expected **403**) and a valid application request without the blocked type. Applying this filter is **not a fix for an underlying PHP/application vulnerability**: keep PHP, extensions and application code patched.
|
Check with `curl -i -H 'Content-Type: multipart/form-data; boundary=test' --data 'x' https://your-vhost.example/upload` (expected **403**) and a valid application request without the blocked type. Applying this filter is **not a fix for an underlying PHP/application vulnerability**: keep PHP, extensions and application code patched.
|
||||||
|
|
||||||
|
## Country access picker
|
||||||
|
|
||||||
|
Under **Vhosts → Edit → Security → Country access**, choose `Off`, `Block` or `Allow`, then search and select country names or ISO alpha-2 codes using the same picker as **Settings → Policies → Country access**. Selected codes are saved in the existing `rate_limit.country_access.countries` field. The picker is disabled in `Off` mode; switching back to `Allow` or `Block` preserves the selection. Country matching still needs the GeoIP database. No configuration migration is required.
|
||||||
|
|
||||||
## Source and backends
|
## Source and backends
|
||||||
|
|
||||||
- **Reverse Proxy:** one Vhost has a backend pool. Each member has a configured URL, ID, enabled flag, weight, optional backup/drain state, health settings and capacity limits.
|
- **Reverse Proxy:** one Vhost has a backend pool. Each member has a configured URL, ID, enabled flag, weight, optional backup/drain state, health settings and capacity limits.
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ ENV_FILE=integrations/routeros-oci-build/.env \
|
|||||||
bash integrations/routeros-oci-build/build-routeros-oci.sh push
|
bash integrations/routeros-oci-build/build-routeros-oci.sh push
|
||||||
```
|
```
|
||||||
|
|
||||||
For example, with RustProxy version `0.38.6` and the defaults this publishes:
|
For example, with RustProxy version `0.38.7` and the defaults this publishes:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
oci.example.net/network/rustproxy:0.38.6
|
oci.example.net/network/rustproxy:0.38.7
|
||||||
oci.example.net/network/rustproxy:latest
|
oci.example.net/network/rustproxy:latest
|
||||||
oci.example.net/network/rustproxy:routeros
|
oci.example.net/network/rustproxy:routeros
|
||||||
```
|
```
|
||||||
|
|||||||
+5
-3
@@ -1015,11 +1015,11 @@
|
|||||||
"vhCacheStaticCookie": "Ignore request cookies for selected static file extensions",
|
"vhCacheStaticCookie": "Ignore request cookies for selected static file extensions",
|
||||||
"vhCacheStaticCustom": "Use a custom static extension list",
|
"vhCacheStaticCustom": "Use a custom static extension list",
|
||||||
"vhCacheStaticExtensions": "Static extensions (one per line, without dot)",
|
"vhCacheStaticExtensions": "Static extensions (one per line, without dot)",
|
||||||
"vhCacheStaticHelp": "Inherit the global policy or override it for this vhost. Ignore Cookie only for files whose bytes do not depend on the session; Set-Cookie, private/no-store and Vary: Cookie still block shared storage.",
|
"vhCacheStaticHelp": "Inherited by default. Use cookie-independent static assets only: the global or vhost Vary: Cookie option can remove that field from public cacheable responses. Set-Cookie, private and no-store still prevent storage.",
|
||||||
"cacheStaticTitle": "Static asset cache boost",
|
"cacheStaticTitle": "Static asset cache boost",
|
||||||
"cacheStaticCookie": "Ignore request cookies for static files",
|
"cacheStaticCookie": "Ignore request cookies for static files",
|
||||||
"cacheStaticExtensions": "Global static extensions (one per line, without dot)",
|
"cacheStaticExtensions": "Global static extensions (one per line, without dot)",
|
||||||
"cacheStaticHelp": "Enable this only for files whose bytes do not depend on the session. Request Cookie then does not affect the shared cache key for these extensions; responses with Set-Cookie, private/no-store or Vary: Cookie are still never stored.",
|
"cacheStaticHelp": "Only enable these options if static file bytes never depend on a session. With the Vary: Cookie option (on by default), an explicitly public, cacheable response may omit Cookie from Vary while retaining other Vary fields. Set-Cookie, private, no-store and missing freshness still prevent storage.",
|
||||||
"vhHttp2Enabled": "Enable HTTP/2 for this vhost",
|
"vhHttp2Enabled": "Enable HTTP/2 for this vhost",
|
||||||
"vhFrontendProtocolsHelp": "H2 and H3 are per-vhost opt-outs. A switch is available only when at least one selected listener has that protocol enabled in Settings > Listeners.",
|
"vhFrontendProtocolsHelp": "H2 and H3 are per-vhost opt-outs. A switch is available only when at least one selected listener has that protocol enabled in Settings > Listeners.",
|
||||||
"administration": "Administration",
|
"administration": "Administration",
|
||||||
@@ -3699,6 +3699,8 @@
|
|||||||
"alertSettingsDockerLink": "Settings → Docker agents",
|
"alertSettingsDockerLink": "Settings → Docker agents",
|
||||||
"alertSettingsNumberInvalid": "Enter a whole number.",
|
"alertSettingsNumberInvalid": "Enter a whole number.",
|
||||||
"alertSettingsCertificateOrder": "The error threshold must be fewer days than the warning threshold.",
|
"alertSettingsCertificateOrder": "The error threshold must be fewer days than the warning threshold.",
|
||||||
"alertSettingsPercentOrder": "The error threshold must be higher than the warning threshold."
|
"alertSettingsPercentOrder": "The error threshold must be higher than the warning threshold.",
|
||||||
|
"vhCacheStaticVaryCookie": "Ignore Vary: Cookie for public static assets (inherit/on/off)",
|
||||||
|
"cacheStaticVaryCookie": "Ignore Vary: Cookie for public static assets"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-3
@@ -1015,11 +1015,11 @@
|
|||||||
"vhCacheStaticCookie": "Ignoruj Cookie żądania dla wybranych rozszerzeń statycznych",
|
"vhCacheStaticCookie": "Ignoruj Cookie żądania dla wybranych rozszerzeń statycznych",
|
||||||
"vhCacheStaticCustom": "Użyj własnej listy rozszerzeń statycznych",
|
"vhCacheStaticCustom": "Użyj własnej listy rozszerzeń statycznych",
|
||||||
"vhCacheStaticExtensions": "Rozszerzenia statyczne (po jednym w linii, bez kropki)",
|
"vhCacheStaticExtensions": "Rozszerzenia statyczne (po jednym w linii, bez kropki)",
|
||||||
"vhCacheStaticHelp": "Dziedzicz ustawienie globalne albo nadpisz je dla vhosta. Ignorowanie Cookie stosuj tylko do plików, których treść nie zależy od sesji; Set-Cookie, private/no-store i Vary: Cookie nadal blokują zapis do shared cache.",
|
"vhCacheStaticHelp": "Domyślnie dziedziczy ustawienia globalne. Stosuj tylko dla plików niezależnych od sesji: opcja Vary: Cookie może usunąć ten nagłówek z publicznych odpowiedzi nadających się do cache. Set-Cookie, private i no-store nadal blokują zapis.",
|
||||||
"cacheStaticTitle": "Cache statycznych zasobów",
|
"cacheStaticTitle": "Cache statycznych zasobów",
|
||||||
"cacheStaticCookie": "Ignoruj Cookie żądania dla statycznych plików",
|
"cacheStaticCookie": "Ignoruj Cookie żądania dla statycznych plików",
|
||||||
"cacheStaticExtensions": "Globalne rozszerzenia statyczne (po jednym w linii, bez kropki)",
|
"cacheStaticExtensions": "Globalne rozszerzenia statyczne (po jednym w linii, bez kropki)",
|
||||||
"cacheStaticHelp": "Włączaj tylko dla plików, których treść nie zależy od sesji. Cookie żądania nie wpływa wtedy na klucz cache dla podanych rozszerzeń; odpowiedzi z Set-Cookie, private/no-store lub Vary: Cookie nadal nie są zapisywane we współdzielonym cache.",
|
"cacheStaticHelp": "Włączaj tylko wtedy, gdy zawartość plików nie zależy od sesji. Opcja Vary: Cookie (domyślnie włączona) usuwa Cookie z Vary jedynie dla publicznych odpowiedzi nadających się do cache, zachowując pozostałe pola Vary. Set-Cookie, private, no-store i brak polityki świeżości nadal blokują zapis.",
|
||||||
"vhHttp2Enabled": "Włącz HTTP/2 dla tego vhosta",
|
"vhHttp2Enabled": "Włącz HTTP/2 dla tego vhosta",
|
||||||
"vhFrontendProtocolsHelp": "H2 i H3 są przełącznikami per vhost. Opcja jest aktywna tylko wtedy, gdy co najmniej jeden wybrany listener ma dany protokół włączony w Ustawienia > Listenery.",
|
"vhFrontendProtocolsHelp": "H2 i H3 są przełącznikami per vhost. Opcja jest aktywna tylko wtedy, gdy co najmniej jeden wybrany listener ma dany protokół włączony w Ustawienia > Listenery.",
|
||||||
"administration": "Panel administracyjny",
|
"administration": "Panel administracyjny",
|
||||||
@@ -3699,6 +3699,8 @@
|
|||||||
"alertSettingsDockerLink": "Ustawienia → Agenci Docker",
|
"alertSettingsDockerLink": "Ustawienia → Agenci Docker",
|
||||||
"alertSettingsNumberInvalid": "Wpisz liczbę całkowitą.",
|
"alertSettingsNumberInvalid": "Wpisz liczbę całkowitą.",
|
||||||
"alertSettingsCertificateOrder": "Próg błędu musi mieć mniej dni niż próg ostrzeżenia.",
|
"alertSettingsCertificateOrder": "Próg błędu musi mieć mniej dni niż próg ostrzeżenia.",
|
||||||
"alertSettingsPercentOrder": "Próg błędu musi być wyższy niż próg ostrzeżenia."
|
"alertSettingsPercentOrder": "Próg błędu musi być wyższy niż próg ostrzeżenia.",
|
||||||
|
"vhCacheStaticVaryCookie": "Ignoruj Vary: Cookie dla publicznych plików statycznych (dziedzicz/wł./wył.)",
|
||||||
|
"cacheStaticVaryCookie": "Ignoruj Vary: Cookie dla publicznych plików statycznych"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+56
-11
@@ -2,7 +2,7 @@
|
|||||||
"openapi": "3.0.3",
|
"openapi": "3.0.3",
|
||||||
"info": {
|
"info": {
|
||||||
"title": "RustProxy Administration API",
|
"title": "RustProxy Administration API",
|
||||||
"version": "0.38.6",
|
"version": "0.38.7",
|
||||||
"description": "Administration API for the active panel origin. Sign in through the panel; the same-origin HttpOnly cookie authenticates all private operations. Mutations also require the exact Origin, X-RustProxy-Request: 1 and a session-bound X-CSRF-Token. Loopback HTTP is the default; Settings can enable HTTPS before using a non-loopback administration bind. This document contains no live configuration or credentials. Object schemas marked extensible are summaries: full configuration validation is authoritative in Rust. The API also permits explicitly scoped GeneralApiBearer tokens on a narrow route allowlist, with RO/RW and source CIDR checks; API-token management and Prometheus-token management are browser-session-only."
|
"description": "Administration API for the active panel origin. Sign in through the panel; the same-origin HttpOnly cookie authenticates all private operations. Mutations also require the exact Origin, X-RustProxy-Request: 1 and a session-bound X-CSRF-Token. Loopback HTTP is the default; Settings can enable HTTPS before using a non-loopback administration bind. This document contains no live configuration or credentials. Object schemas marked extensible are summaries: full configuration validation is authoritative in Rust. The API also permits explicitly scoped GeneralApiBearer tokens on a narrow route allowlist, with RO/RW and source CIDR checks; API-token management and Prometheus-token management are browser-session-only."
|
||||||
},
|
},
|
||||||
"servers": [
|
"servers": [
|
||||||
@@ -862,13 +862,19 @@
|
|||||||
},
|
},
|
||||||
"timing_header_names": {
|
"timing_header_names": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["standard", "cdn", "legacy"],
|
"enum": [
|
||||||
|
"standard",
|
||||||
|
"cdn",
|
||||||
|
"legacy"
|
||||||
|
],
|
||||||
"default": "standard",
|
"default": "standard",
|
||||||
"description": "Metric names in Server-Timing. standard (reverse proxy): proxy;dur, upstream;dur, proxy-cache;desc. cdn (RustProxy is the outermost CDN-like edge): edge;dur, origin;dur, cdn-cache;desc. legacy (before 0.38.2): proxy;dur, origin;dur, cache;desc. The cache value is HIT, MISS, BYPASS, STALE or REVALIDATED."
|
"description": "Metric names in Server-Timing. standard (reverse proxy): proxy;dur, upstream;dur, proxy-cache;desc. cdn (RustProxy is the outermost CDN-like edge): edge;dur, origin;dur, cdn-cache;desc. legacy (before 0.38.2): proxy;dur, origin;dur, cache;desc. The cache value is HIT, MISS, BYPASS, STALE or REVALIDATED."
|
||||||
},
|
},
|
||||||
"timing_allow_origin": {
|
"timing_allow_origin": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": { "type": "string" },
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"maxItems": 16,
|
"maxItems": 16,
|
||||||
"description": "Timing-Allow-Origin sent with Server-Timing: origins such as https://app.example.com that may read the timings from scripts, or a single \"*\". Empty sends no header (same-origin scripts can always read them)."
|
"description": "Timing-Allow-Origin sent with Server-Timing: origins such as https://app.example.com that may read the timings from scripts, or a single \"*\". Empty sends no header (same-origin scripts can always read them)."
|
||||||
},
|
},
|
||||||
@@ -2513,6 +2519,11 @@
|
|||||||
"$ref": "#/components/schemas/CacheRule"
|
"$ref": "#/components/schemas/CacheRule"
|
||||||
},
|
},
|
||||||
"description": "Global cache rules (Cache → Rules)."
|
"description": "Global cache rules (Cache → Rules)."
|
||||||
|
},
|
||||||
|
"static_ignore_vary_cookie": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true,
|
||||||
|
"description": "For cookie-independent configured static extensions only, omit Cookie from Vary on explicitly public, otherwise cacheable responses. Requires static_ignore_cookies. Preserves other Vary dimensions and all private/no-store/Set-Cookie safeguards."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
@@ -3461,14 +3472,48 @@
|
|||||||
"default": false,
|
"default": false,
|
||||||
"description": "Explicit, persistent administrator opt-in: allow assigning a named public certificate to hostnames not covered by its DNS SAN. This does not suppress TLS client warnings, validate the certificate less during agent polling, or disable backend TLS verification. Requires a named certificate."
|
"description": "Explicit, persistent administrator opt-in: allow assigning a named public certificate to hostnames not covered by its DNS SAN. This does not suppress TLS client warnings, validate the certificate less during agent polling, or disable backend TLS verification. Requires a named certificate."
|
||||||
},
|
},
|
||||||
"timing_headers": { "type": "boolean", "default": false, "description": "Since 0.38.3. Server-Timing diagnostics for this Docker vhost." },
|
"timing_headers": {
|
||||||
"backend_header": { "type": "boolean", "default": false, "description": "Since 0.38.3. X-Rust-Proxy-Backend with the generated backend id." },
|
"type": "boolean",
|
||||||
"backend_timing_header": { "type": "boolean", "default": false, "description": "Since 0.38.3. X-RustProxy-Backend-Time with the origin response-header latency." },
|
"default": false,
|
||||||
"cloudflare_client_ip": { "type": "boolean", "default": false, "description": "Since 0.38.3. Use verified Cloudflare client-IP and country headers, as on ordinary vhosts." },
|
"description": "Since 0.38.3. Server-Timing diagnostics for this Docker vhost."
|
||||||
"method_policy": { "type": "object", "description": "Since 0.38.3. Same format as the vhost method_policy: mode off, allow or block with a list of methods." },
|
},
|
||||||
"rate_limit": { "type": "object", "nullable": true, "default": null, "description": "Since 0.38.3. Same format as the vhost rate_limit (per-client IP limit and country_access); null = off." },
|
"backend_header": {
|
||||||
"security_headers": { "type": "object", "nullable": true, "default": null, "description": "Since 0.38.3. Same format as the vhost security_headers (HSTS, nosniff, frame_options, referrer_policy, CSP, permissions policy); null = none." },
|
"type": "boolean",
|
||||||
"basic_auth": { "type": "object", "nullable": true, "default": null, "description": "Since 0.38.3. Same format as the vhost basic_auth: enabled, realm, require_tls, forward_credentials and users with Argon2id password_hash from POST /api/basic-auth/hash; null = no login." }
|
"default": false,
|
||||||
|
"description": "Since 0.38.3. X-Rust-Proxy-Backend with the generated backend id."
|
||||||
|
},
|
||||||
|
"backend_timing_header": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "Since 0.38.3. X-RustProxy-Backend-Time with the origin response-header latency."
|
||||||
|
},
|
||||||
|
"cloudflare_client_ip": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "Since 0.38.3. Use verified Cloudflare client-IP and country headers, as on ordinary vhosts."
|
||||||
|
},
|
||||||
|
"method_policy": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Since 0.38.3. Same format as the vhost method_policy: mode off, allow or block with a list of methods."
|
||||||
|
},
|
||||||
|
"rate_limit": {
|
||||||
|
"type": "object",
|
||||||
|
"nullable": true,
|
||||||
|
"default": null,
|
||||||
|
"description": "Since 0.38.3. Same format as the vhost rate_limit (per-client IP limit and country_access); null = off."
|
||||||
|
},
|
||||||
|
"security_headers": {
|
||||||
|
"type": "object",
|
||||||
|
"nullable": true,
|
||||||
|
"default": null,
|
||||||
|
"description": "Since 0.38.3. Same format as the vhost security_headers (HSTS, nosniff, frame_options, referrer_policy, CSP, permissions policy); null = none."
|
||||||
|
},
|
||||||
|
"basic_auth": {
|
||||||
|
"type": "object",
|
||||||
|
"nullable": true,
|
||||||
|
"default": null,
|
||||||
|
"description": "Since 0.38.3. Same format as the vhost basic_auth: enabled, realm, require_tls, forward_credentials and users with Argon2id password_hash from POST /api/basic-auth/hash; null = no login."
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"service_key",
|
"service_key",
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ function renderSettings() {
|
|||||||
$("cache-proactive-enabled").checked = c.proactive_refresh_enabled === true; $("cache-proactive-before").value = c.proactive_refresh_before_expiry_seconds ?? 15; $("cache-proactive-percent").value = c.proactive_refresh_percent ?? 10; $("cache-proactive-inflight").value = c.proactive_refresh_max_inflight ?? 4;
|
$("cache-proactive-enabled").checked = c.proactive_refresh_enabled === true; $("cache-proactive-before").value = c.proactive_refresh_before_expiry_seconds ?? 15; $("cache-proactive-percent").value = c.proactive_refresh_percent ?? 10; $("cache-proactive-inflight").value = c.proactive_refresh_max_inflight ?? 4;
|
||||||
$("cache-query").checked = !!c.bypass_query; $("cache-prefixes").value = (c.bypass_prefixes || []).join("\n");
|
$("cache-query").checked = !!c.bypass_query; $("cache-prefixes").value = (c.bypass_prefixes || []).join("\n");
|
||||||
$("cache-http-invalidation-cidrs").value = (c.http_invalidation_allowed_cidrs || []).join("\n");
|
$("cache-http-invalidation-cidrs").value = (c.http_invalidation_allowed_cidrs || []).join("\n");
|
||||||
$("cache-static-cookie").checked = c.static_ignore_cookies !== false; $("cache-static-extensions").value = (c.static_extensions || []).join("\n");
|
$("cache-static-cookie").checked = c.static_ignore_cookies !== false; $("cache-static-vary-cookie").checked = c.static_ignore_vary_cookie !== false; $("cache-static-extensions").value = (c.static_extensions || []).join("\n");
|
||||||
$("cache-status-header").checked = !!c.expose_status; $("cache-hits-header").checked = !!c.expose_hits; $("cache-rfc-header").checked = !!c.expose_cache_status; $("cache-resident-age-header").checked = !!c.expose_resident_age; $("cache-only-hits").checked = !!c.expose_only_hits; $("cache-detailed-status").checked = !!c.expose_detailed_status;
|
$("cache-status-header").checked = !!c.expose_status; $("cache-hits-header").checked = !!c.expose_hits; $("cache-rfc-header").checked = !!c.expose_cache_status; $("cache-resident-age-header").checked = !!c.expose_resident_age; $("cache-only-hits").checked = !!c.expose_only_hits; $("cache-detailed-status").checked = !!c.expose_detailed_status;
|
||||||
const viaHeader = c.via_header === undefined ? "RustProxy" : c.via_header;
|
const viaHeader = c.via_header === undefined ? "RustProxy" : c.via_header;
|
||||||
$("cache-via-enabled").checked = viaHeader !== null; $("cache-via-value").value = viaHeader || "RustProxy"; syncCacheVia();
|
$("cache-via-enabled").checked = viaHeader !== null; $("cache-via-value").value = viaHeader || "RustProxy"; syncCacheVia();
|
||||||
@@ -376,7 +376,7 @@ bindSettingsForm("response-form", next => {
|
|||||||
next.compression = { min_bytes: Number($("compress-min").value) }; for (const name of ["gzip", "br", "zstd", "deflate"]) next.compression[name] = $(`compress-${name}`).checked;
|
next.compression = { min_bytes: Number($("compress-min").value) }; for (const name of ["gzip", "br", "zstd", "deflate"]) next.compression[name] = $(`compress-${name}`).checked;
|
||||||
}, "response", next => ({ server_header: next.server_header, diagnostic_headers: next.diagnostic_headers, compression: next.compression }));
|
}, "response", next => ({ server_header: next.server_header, diagnostic_headers: next.diagnostic_headers, compression: next.compression }));
|
||||||
bindSettingsForm("cache-form", next => {
|
bindSettingsForm("cache-form", next => {
|
||||||
next.cache = { ...(next.cache || {}), enabled: $("cache-enabled").checked, varnish_compatible: $("cache-varnish-compatible").checked, varnish_grace_seconds: Number($("cache-varnish-grace").value), memory_preset: selectedCacheMemoryPreset, max_bytes: Math.round(Number($("cache-memory").value) * 1048576), transient_max_bytes: Math.round(Number($("cache-transient-memory").value) * 1048576), max_object_bytes: Number($("cache-object").value) * 1024, max_entries: Number($("cache-entries").value), hot_eviction_max_objects: Number($("cache-eviction-limit").value), hot_auto_trim_enabled: $("cache-auto-trim-enabled").checked, hot_auto_trim_after_seconds: Number($("cache-auto-trim-after").value), hot_auto_trim_target_percent: Number($("cache-auto-trim-target").value), cold_enabled: $("cache-cold-enabled").checked, cold_preset: selectedCacheColdPreset, cold_path: $("cache-cold-path").value.trim(), cold_max_bytes: Math.round(Number($("cache-cold-bytes").value) * 1048576), cold_max_entries: Number($("cache-cold-entries").value), cold_queue_max_bytes: Math.round(Number($("cache-cold-queue-bytes").value) * 1048576), cold_gc_interval_seconds: Number($("cache-cold-gc-interval").value), cold_gc_max_delete: Number($("cache-cold-gc-max-delete").value), cold_after_seconds: Number($("cache-cold-after").value), cold_max_hot_seconds: Number($("cache-cold-max-hot").value), cold_on_idle: $("cache-cold-on-idle").checked, cold_on_age: $("cache-cold-on-age").checked, cold_on_lru: $("cache-cold-on-lru").checked, cold_on_shutdown: $("cache-cold-on-shutdown").checked, max_ttl_seconds: Number($("cache-ttl").value), default_ttl_seconds: Number($("cache-default-ttl").value), collapse_enabled: $("cache-collapse-enabled").checked, collapse_wait_timeout_ms: Number($("cache-collapse-timeout").value), collapse_timeout_fallback: $("cache-collapse-fallback").value, stale_if_error_timeout: $("cache-sie-timeout").checked, stale_if_error_connection: $("cache-sie-connection").checked, stale_if_error_dns: $("cache-sie-dns").checked, stale_if_error_tls: $("cache-sie-tls").checked, stale_if_error_statuses: $("cache-sie-statuses").value.split(/[\s,]+/).filter(Boolean).map(Number), proactive_refresh_enabled: $("cache-proactive-enabled").checked, proactive_refresh_before_expiry_seconds: Number($("cache-proactive-before").value), proactive_refresh_percent: Number($("cache-proactive-percent").value), proactive_refresh_max_inflight: Number($("cache-proactive-inflight").value), bypass_query: $("cache-query").checked, bypass_prefixes: $("cache-prefixes").value.split(/\r?\n/).map(v => v.trim()).filter(Boolean), http_invalidation_allowed_cidrs: $("cache-http-invalidation-cidrs").value.split(/[\n,]+/).map(v => v.trim()).filter(Boolean), static_ignore_cookies: $("cache-static-cookie").checked, static_extensions: $("cache-static-extensions").value.split(/[\n,]+/).map(v => v.trim().replace(/^\./, "").toLowerCase()).filter(Boolean), expose_status: $("cache-status-header").checked, expose_hits: $("cache-hits-header").checked, expose_cache_status: $("cache-rfc-header").checked, expose_resident_age: $("cache-resident-age-header").checked, expose_only_hits: $("cache-only-hits").checked, expose_detailed_status: $("cache-detailed-status").checked, via_header: $("cache-via-enabled").checked ? $("cache-via-value").value.trim() : null, rules: cacheRulesEditor ? cacheRulesEditor.read() : (next.cache?.rules || []) };
|
next.cache = { ...(next.cache || {}), enabled: $("cache-enabled").checked, varnish_compatible: $("cache-varnish-compatible").checked, varnish_grace_seconds: Number($("cache-varnish-grace").value), memory_preset: selectedCacheMemoryPreset, max_bytes: Math.round(Number($("cache-memory").value) * 1048576), transient_max_bytes: Math.round(Number($("cache-transient-memory").value) * 1048576), max_object_bytes: Number($("cache-object").value) * 1024, max_entries: Number($("cache-entries").value), hot_eviction_max_objects: Number($("cache-eviction-limit").value), hot_auto_trim_enabled: $("cache-auto-trim-enabled").checked, hot_auto_trim_after_seconds: Number($("cache-auto-trim-after").value), hot_auto_trim_target_percent: Number($("cache-auto-trim-target").value), cold_enabled: $("cache-cold-enabled").checked, cold_preset: selectedCacheColdPreset, cold_path: $("cache-cold-path").value.trim(), cold_max_bytes: Math.round(Number($("cache-cold-bytes").value) * 1048576), cold_max_entries: Number($("cache-cold-entries").value), cold_queue_max_bytes: Math.round(Number($("cache-cold-queue-bytes").value) * 1048576), cold_gc_interval_seconds: Number($("cache-cold-gc-interval").value), cold_gc_max_delete: Number($("cache-cold-gc-max-delete").value), cold_after_seconds: Number($("cache-cold-after").value), cold_max_hot_seconds: Number($("cache-cold-max-hot").value), cold_on_idle: $("cache-cold-on-idle").checked, cold_on_age: $("cache-cold-on-age").checked, cold_on_lru: $("cache-cold-on-lru").checked, cold_on_shutdown: $("cache-cold-on-shutdown").checked, max_ttl_seconds: Number($("cache-ttl").value), default_ttl_seconds: Number($("cache-default-ttl").value), collapse_enabled: $("cache-collapse-enabled").checked, collapse_wait_timeout_ms: Number($("cache-collapse-timeout").value), collapse_timeout_fallback: $("cache-collapse-fallback").value, stale_if_error_timeout: $("cache-sie-timeout").checked, stale_if_error_connection: $("cache-sie-connection").checked, stale_if_error_dns: $("cache-sie-dns").checked, stale_if_error_tls: $("cache-sie-tls").checked, stale_if_error_statuses: $("cache-sie-statuses").value.split(/[\s,]+/).filter(Boolean).map(Number), proactive_refresh_enabled: $("cache-proactive-enabled").checked, proactive_refresh_before_expiry_seconds: Number($("cache-proactive-before").value), proactive_refresh_percent: Number($("cache-proactive-percent").value), proactive_refresh_max_inflight: Number($("cache-proactive-inflight").value), bypass_query: $("cache-query").checked, bypass_prefixes: $("cache-prefixes").value.split(/\r?\n/).map(v => v.trim()).filter(Boolean), http_invalidation_allowed_cidrs: $("cache-http-invalidation-cidrs").value.split(/[\n,]+/).map(v => v.trim()).filter(Boolean), static_ignore_cookies: $("cache-static-cookie").checked, static_ignore_vary_cookie: $("cache-static-vary-cookie").checked, static_extensions: $("cache-static-extensions").value.split(/[\n,]+/).map(v => v.trim().replace(/^\./, "").toLowerCase()).filter(Boolean), expose_status: $("cache-status-header").checked, expose_hits: $("cache-hits-header").checked, expose_cache_status: $("cache-rfc-header").checked, expose_resident_age: $("cache-resident-age-header").checked, expose_only_hits: $("cache-only-hits").checked, expose_detailed_status: $("cache-detailed-status").checked, via_header: $("cache-via-enabled").checked ? $("cache-via-value").value.trim() : null, rules: cacheRulesEditor ? cacheRulesEditor.read() : (next.cache?.rules || []) };
|
||||||
}, "cache");
|
}, "cache");
|
||||||
bindSettingsForm("transform-form", next => {
|
bindSettingsForm("transform-form", next => {
|
||||||
next.transform = {
|
next.transform = {
|
||||||
|
|||||||
@@ -1357,9 +1357,9 @@
|
|||||||
<label class="check" data-acme-provider="rfc2136"><input class="switch"
|
<label class="check" data-acme-provider="rfc2136"><input class="switch"
|
||||||
id="acme-sign-query" type="checkbox" /><span
|
id="acme-sign-query" type="checkbox" /><span
|
||||||
data-i18n="acmeSignQuery"></span></label>
|
data-i18n="acmeSignQuery"></span></label>
|
||||||
<label class="check vh-wide"><input id="acme-tos" required=""
|
<label class="check vh-wide"><input class="switch" id="acme-tos" required=""
|
||||||
type="checkbox" /><span data-i18n="acmeTos"></span></label>
|
type="checkbox" /><span data-i18n="acmeTos"></span></label>
|
||||||
<label class="check vh-wide"><input id="acme-confirm-production"
|
<label class="check vh-wide"><input class="switch" id="acme-confirm-production"
|
||||||
type="checkbox" /><span
|
type="checkbox" /><span
|
||||||
data-i18n="acmeConfirmProduction"></span></label>
|
data-i18n="acmeConfirmProduction"></span></label>
|
||||||
<label class="vh-wide" data-acme-provider="cloudflare"><span
|
<label class="vh-wide" data-acme-provider="cloudflare"><span
|
||||||
@@ -3001,12 +3001,15 @@
|
|||||||
<label class="check"><input class="switch" id="cache-static-cookie" type="checkbox" /><span
|
<label class="check"><input class="switch" id="cache-static-cookie" type="checkbox" /><span
|
||||||
data-i18n="cacheStaticCookie">Ignore request cookies for static
|
data-i18n="cacheStaticCookie">Ignore request cookies for static
|
||||||
files</span></label>
|
files</span></label>
|
||||||
|
<label class="check"><input class="switch" id="cache-static-vary-cookie" type="checkbox" checked /><span
|
||||||
|
data-i18n="cacheStaticVaryCookie">Ignore Vary: Cookie for public static assets</span></label>
|
||||||
<label data-i18n="cacheStaticExtensions" for="cache-static-extensions">Global static
|
<label data-i18n="cacheStaticExtensions" for="cache-static-extensions">Global static
|
||||||
extensions</label><textarea id="cache-static-extensions" rows="5"
|
extensions</label><textarea id="cache-static-extensions" rows="5"
|
||||||
spellcheck="false"></textarea>
|
spellcheck="false"></textarea>
|
||||||
<p class="fine cache-static-guidance" data-i18n="cacheStaticHelp">Cookie bypass is
|
<p class="fine cache-static-guidance" data-i18n="cacheStaticHelp">Use only for
|
||||||
limited to these file
|
static assets that never depend on user sessions. Cookie is removed from Vary
|
||||||
extensions. Response privacy rules still apply.</p>
|
only for explicitly public, cacheable responses; private, no-store and
|
||||||
|
Set-Cookie still prevent caching.</p>
|
||||||
<h3 class="subheading cache-header-settings-heading"
|
<h3 class="subheading cache-header-settings-heading"
|
||||||
data-i18n="cacheHeadersSection">Cache response headers</h3>
|
data-i18n="cacheHeadersSection">Cache response headers</h3>
|
||||||
<div class="switch-grid"><label class="check"><input class="switch" id="cache-status-header"
|
<div class="switch-grid"><label class="check"><input class="switch" id="cache-status-header"
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ const defaults = () => ({
|
|||||||
|
|
||||||
function activateTab(name) { document.querySelectorAll("#vhost-tabs button").forEach(b => { const active = b.dataset.tab === name; b.classList.toggle("active", active); b.setAttribute("aria-pressed", String(active)); b.setAttribute("aria-selected", String(active)); b.tabIndex = active ? 0 : -1; }); container.querySelectorAll(".vh-group").forEach(g => g.hidden = g.dataset.tab !== name); }
|
function activateTab(name) { document.querySelectorAll("#vhost-tabs button").forEach(b => { const active = b.dataset.tab === name; b.classList.toggle("active", active); b.setAttribute("aria-pressed", String(active)); b.setAttribute("aria-selected", String(active)); b.tabIndex = active ? 0 : -1; }); container.querySelectorAll(".vh-group").forEach(g => g.hidden = g.dataset.tab !== name); }
|
||||||
function initTabs() { const tabs = $("vhost-tabs"); tabs.replaceChildren(); tabs.setAttribute("role", "tablist"); for (const [name, key] of [["details", "vhDetailsTab"], ["backends", "vhBackendPool"], ["health", "vhHealth"], ["locations", "vhLocations"], ["auth", "vhTabAuth"], ["ssl", "vhSsl"], ["cache", "vhCache"], ["compression", "vhCompression"], ["transform", "vhTransform"], ["security", "vhSecurity"], ["pages", "vhPages"], ["advanced", "advanced"]]) { const b = button(key, () => activateTab(name)); b.dataset.tab = name; b.setAttribute("role", "tab"); b.addEventListener("keydown", event => { const buttons = [...tabs.querySelectorAll("button")], index = buttons.indexOf(b); let next; if (event.key === "ArrowRight" || event.key === "ArrowDown") next = (index + 1) % buttons.length; else if (event.key === "ArrowLeft" || event.key === "ArrowUp") next = (index + buttons.length - 1) % buttons.length; else if (event.key === "Home") next = 0; else if (event.key === "End") next = buttons.length - 1; else return; event.preventDefault(); activateTab(buttons[next].dataset.tab); buttons[next].focus(); }); tabs.append(b); } activateTab("details"); }
|
function initTabs() { const tabs = $("vhost-tabs"); tabs.replaceChildren(); tabs.setAttribute("role", "tablist"); for (const [name, key] of [["details", "vhDetailsTab"], ["backends", "vhBackendPool"], ["health", "vhHealth"], ["locations", "vhLocations"], ["auth", "vhTabAuth"], ["ssl", "vhSsl"], ["cache", "vhCache"], ["compression", "vhCompression"], ["transform", "vhTransform"], ["security", "vhSecurity"], ["pages", "vhPages"], ["advanced", "advanced"]]) { const b = button(key, () => activateTab(name)); b.dataset.tab = name; b.setAttribute("role", "tab"); b.addEventListener("keydown", event => { const buttons = [...tabs.querySelectorAll("button")], index = buttons.indexOf(b); let next; if (event.key === "ArrowRight" || event.key === "ArrowDown") next = (index + 1) % buttons.length; else if (event.key === "ArrowLeft" || event.key === "ArrowUp") next = (index + buttons.length - 1) % buttons.length; else if (event.key === "Home") next = 0; else if (event.key === "End") next = buttons.length - 1; else return; event.preventDefault(); activateTab(buttons[next].dataset.tab); buttons[next].focus(); }); tabs.append(b); } activateTab("details"); }
|
||||||
function collectCache() { const tri = name => str(name) === "" ? null : str(name) === "on", number = (name, mul = 1) => { if (str(name) === "") return null; const value = Number(str(name)) * mul; if (!Number.isSafeInteger(value)) throw new Error(t("vhJsonInvalid")); return value; }; return { enabled: tri("vh-cache-enabled"), max_ttl_seconds: number("vh-cache-ttl"), default_ttl_seconds: number("vh-cache-default"), max_object_bytes: number("vh-cache-object", 1024), bypass_query: tri("vh-cache-query"), static_ignore_cookies: tri("vh-cache-static-cookie"), static_extensions: yes("vh-cache-static-custom") ? lines(str("vh-cache-static-extensions")).map(v => v.replace(/^\./, "").toLowerCase()) : null, expose_status: tri("vh-cache-status"), expose_hits: tri("vh-cache-hits"), expose_cache_status: tri("vh-cache-rfc"), expose_resident_age: tri("vh-cache-resident-age"), expose_only_hits: tri("vh-cache-only-hits"), expose_detailed_status: tri("vh-cache-detailed-status"), bypass_prefixes: yes("vh-cache-prefix-custom") ? lines(str("vh-cache-prefixes")) : null, unsafe_force: { enabled: yes("vh-cache-force-enabled"), targets: lines(str("vh-cache-force-targets")) }, rules: vhostCacheRulesEditor ? vhostCacheRulesEditor.read() : [], ignore_global_rules: vhostCacheRulesEditor ? vhostCacheRulesEditor.ignoreGlobal() : false }; }
|
function collectCache() { const tri = name => str(name) === "" ? null : str(name) === "on", number = (name, mul = 1) => { if (str(name) === "") return null; const value = Number(str(name)) * mul; if (!Number.isSafeInteger(value)) throw new Error(t("vhJsonInvalid")); return value; }; return { enabled: tri("vh-cache-enabled"), max_ttl_seconds: number("vh-cache-ttl"), default_ttl_seconds: number("vh-cache-default"), max_object_bytes: number("vh-cache-object", 1024), bypass_query: tri("vh-cache-query"), static_ignore_cookies: tri("vh-cache-static-cookie"), static_ignore_vary_cookie: tri("vh-cache-static-vary-cookie"), static_extensions: yes("vh-cache-static-custom") ? lines(str("vh-cache-static-extensions")).map(v => v.replace(/^\./, "").toLowerCase()) : null, expose_status: tri("vh-cache-status"), expose_hits: tri("vh-cache-hits"), expose_cache_status: tri("vh-cache-rfc"), expose_resident_age: tri("vh-cache-resident-age"), expose_only_hits: tri("vh-cache-only-hits"), expose_detailed_status: tri("vh-cache-detailed-status"), bypass_prefixes: yes("vh-cache-prefix-custom") ? lines(str("vh-cache-prefixes")) : null, unsafe_force: { enabled: yes("vh-cache-force-enabled"), targets: lines(str("vh-cache-force-targets")) }, rules: vhostCacheRulesEditor ? vhostCacheRulesEditor.read() : [], ignore_global_rules: vhostCacheRulesEditor ? vhostCacheRulesEditor.ignoreGlobal() : false }; }
|
||||||
function collectCompression() { const tri = name => str(name) === "" ? null : str(name) === "on"; return { enabled: tri("vh-compression-enabled"), zstd: tri("vh-compression-zstd"), br: tri("vh-compression-br"), gzip: tri("vh-compression-gzip"), deflate: tri("vh-compression-deflate") }; }
|
function collectCompression() { const tri = name => str(name) === "" ? null : str(name) === "on"; return { enabled: tri("vh-compression-enabled"), zstd: tri("vh-compression-zstd"), br: tri("vh-compression-br"), gzip: tri("vh-compression-gzip"), deflate: tri("vh-compression-deflate") }; }
|
||||||
function collectTransform() {
|
function collectTransform() {
|
||||||
const tri = name => str(name) === "" ? null : str(name) === "on";
|
const tri = name => str(name) === "" ? null : str(name) === "on";
|
||||||
|
|||||||
@@ -313,8 +313,11 @@ function load(value = defaults(), migrationIds = [], show = true) {
|
|||||||
note(rateFields, "vhRateHelp");
|
note(rateFields, "vhRateHelp");
|
||||||
|
|
||||||
const countryFields = subsection(g, "vhTrafficCountrySection");
|
const countryFields = subsection(g, "vhTrafficCountrySection");
|
||||||
field(countryFields, "country-mode", "vhCountryMode", access.mode || "off", "select", { values: [["off", "vhOff"], ["block", "vhCountryBlock"], ["allow", "vhCountryAllow"]] });
|
const countryMode = field(countryFields, "country-mode", "vhCountryMode", access.mode || "off", "select", { values: [["off", "vhOff"], ["block", "vhCountryBlock"], ["allow", "vhCountryAllow"]] });
|
||||||
field(countryFields, "country-list", "vhCountryList", (access.countries || []).join("\n"), "textarea", { rows: 3, maxLength: 1024 });
|
const countryList = field(countryFields, "country-list", "vhCountryList", (access.countries || []).join("\n"), "textarea", { rows: 3, maxLength: 1024 });
|
||||||
|
window.rustProxyCountryPicker?.attach(countryList);
|
||||||
|
const syncCountryPicker = () => { countryList.disabled = countryMode.value === "off"; };
|
||||||
|
countryMode.addEventListener("change", syncCountryPicker); syncCountryPicker();
|
||||||
note(countryFields, "vhCountryPolicyHelp");
|
note(countryFields, "vhCountryPolicyHelp");
|
||||||
|
|
||||||
const countryRateFields = subsection(g, "vhTrafficCountryRatesSection");
|
const countryRateFields = subsection(g, "vhTrafficCountryRatesSection");
|
||||||
@@ -515,6 +518,7 @@ function load(value = defaults(), migrationIds = [], show = true) {
|
|||||||
field(cacheOptions, "vh-cache-object", "vhCacheObject", cache.max_object_bytes == null ? "" : cache.max_object_bytes / 1024, "number", { min: 1, step: "any", max: (envelope?.config.cache?.max_object_bytes ?? 1048576) / 1024 });
|
field(cacheOptions, "vh-cache-object", "vhCacheObject", cache.max_object_bytes == null ? "" : cache.max_object_bytes / 1024, "number", { min: 1, step: "any", max: (envelope?.config.cache?.max_object_bytes ?? 1048576) / 1024 });
|
||||||
tri(cacheOptions, "vh-cache-query", "cacheBypassQuery", cache.bypass_query);
|
tri(cacheOptions, "vh-cache-query", "cacheBypassQuery", cache.bypass_query);
|
||||||
tri(cacheOptions, "vh-cache-static-cookie", "vhCacheStaticCookie", cache.static_ignore_cookies);
|
tri(cacheOptions, "vh-cache-static-cookie", "vhCacheStaticCookie", cache.static_ignore_cookies);
|
||||||
|
tri(cacheOptions, "vh-cache-static-vary-cookie", "vhCacheStaticVaryCookie", cache.static_ignore_vary_cookie);
|
||||||
const staticExtensionFields = el("div", undefined, "vh-wide vh-override-fields"); cacheOptions.append(staticExtensionFields);
|
const staticExtensionFields = el("div", undefined, "vh-wide vh-override-fields"); cacheOptions.append(staticExtensionFields);
|
||||||
const customStatic = field(staticExtensionFields, "vh-cache-static-custom", "vhCacheStaticCustom", cache.static_extensions != null, "checkbox", { switch: true });
|
const customStatic = field(staticExtensionFields, "vh-cache-static-custom", "vhCacheStaticCustom", cache.static_extensions != null, "checkbox", { switch: true });
|
||||||
const staticExtensions = field(staticExtensionFields, "vh-cache-static-extensions", "vhCacheStaticExtensions", (cache.static_extensions || envelope?.config.cache?.static_extensions || []).join("\n"), "textarea", { rows: 5, maxLength: 2048 });
|
const staticExtensions = field(staticExtensionFields, "vh-cache-static-extensions", "vhCacheStaticExtensions", (cache.static_extensions || envelope?.config.cache?.static_extensions || []).join("\n"), "textarea", { rows: 5, maxLength: 2048 });
|
||||||
|
|||||||
Vendored
+248
@@ -958,6 +958,144 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[test]
|
||||||
|
fn vary_keys_normalize_only_known_equivalent_header_values() {
|
||||||
|
fn keyed(name: &str, fields: &[&str]) -> Key {
|
||||||
|
let mut request = HeaderMap::new();
|
||||||
|
let header_name = http::HeaderName::from_bytes(name.as_bytes()).unwrap();
|
||||||
|
for field in fields {
|
||||||
|
request.append(
|
||||||
|
header_name.clone(),
|
||||||
|
HeaderValue::from_str(field).unwrap(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
variant_key(&[0x52; 32], &[name.to_owned()], &request)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RFC 9111 section 4.1: OWS, equivalent repeated list fields,
|
||||||
|
// case-insensitive language tags and equivalent qvalues.
|
||||||
|
assert_eq!(
|
||||||
|
keyed("accept-language", &["en,pl;q=0.5"]),
|
||||||
|
keyed("accept-language", &["EN ; q=1.0", " PL ; Q=0.500"])
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
keyed("accept-encoding", &["GZIP ; q=1, BR;q=0.800"]),
|
||||||
|
keyed("accept-encoding", &["gzip", "br;q=0.8"])
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
keyed("accept-charset", &["UTF-8, iso-8859-1;q=0.8"]),
|
||||||
|
keyed("accept-charset", &["utf-8;q=1.000", "ISO-8859-1 ;q=0.80"])
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
keyed("accept", &["TEXT/HTML ;level=One, application/json"]),
|
||||||
|
keyed("accept", &["text/html;level=One", "application/json"])
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
keyed("accept", &["text/plain;profile=\"a,b\", application/json"]),
|
||||||
|
keyed("accept", &["text/plain;profile=\"a,b\"", "application/json"])
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
keyed("if-none-match", &["\"tag,a\", W/\"tag-b\""]),
|
||||||
|
keyed("if-none-match", &["\"tag,a\"", "W/\"tag-b\""])
|
||||||
|
);
|
||||||
|
|
||||||
|
// Header order remains significant unless a field's specification
|
||||||
|
// guarantees otherwise; opaque and session-related values stay exact.
|
||||||
|
assert_ne!(
|
||||||
|
keyed("accept-language", &["en,pl"]),
|
||||||
|
keyed("accept-language", &["pl,en"])
|
||||||
|
);
|
||||||
|
assert_ne!(
|
||||||
|
keyed("accept-encoding", &["gzip;q=0.5"]),
|
||||||
|
keyed("accept-encoding", &["gzip;q=0.6"])
|
||||||
|
);
|
||||||
|
assert_ne!(
|
||||||
|
keyed("accept", &["text/plain;profile=Case"]),
|
||||||
|
keyed("accept", &["text/plain;profile=case"])
|
||||||
|
);
|
||||||
|
assert_ne!(
|
||||||
|
keyed("accept", &["text/plain;profile=\"a, b\""]),
|
||||||
|
keyed("accept", &["text/plain;profile=\"a,b\""])
|
||||||
|
);
|
||||||
|
assert_ne!(
|
||||||
|
keyed("x-custom", &["foo, bar"]),
|
||||||
|
keyed("x-custom", &["foo,bar"])
|
||||||
|
);
|
||||||
|
assert_eq!(keyed("x-custom", &[" token "]), keyed("x-custom", &["token"]));
|
||||||
|
assert_ne!(
|
||||||
|
keyed("x-custom", &["foo", "bar"]),
|
||||||
|
keyed("x-custom", &["foo,bar"])
|
||||||
|
);
|
||||||
|
assert_ne!(keyed("user-agent", &["Agent"]), keyed("user-agent", &["agent"]));
|
||||||
|
assert_ne!(
|
||||||
|
keyed("cookie", &["session=one; theme=dark"]),
|
||||||
|
keyed("cookie", &["session=two; theme=dark"])
|
||||||
|
);
|
||||||
|
assert_ne!(keyed("user-agent", &[]), keyed("user-agent", &[""]));
|
||||||
|
assert_ne!(
|
||||||
|
keyed("accept-encoding", &["gzip;q=invalid"]),
|
||||||
|
keyed("accept-encoding", &["gzip"])
|
||||||
|
);
|
||||||
|
// Invalid raw fields cannot collide with a valid canonical value.
|
||||||
|
assert_ne!(
|
||||||
|
keyed("accept-encoding", &["gzip;q=1000"]),
|
||||||
|
keyed("accept-encoding", &["gzip"])
|
||||||
|
);
|
||||||
|
assert_ne!(
|
||||||
|
keyed("accept-language", &["en;q=1000"]),
|
||||||
|
keyed("accept-language", &["en"])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn hot_vary_hit_uses_semantic_header_normalization() {
|
||||||
|
let cache = Cache::new(1);
|
||||||
|
let settings = settings();
|
||||||
|
let mut original = HeaderMap::new();
|
||||||
|
original.insert("accept-language", "en,pl;q=0.5".parse().unwrap());
|
||||||
|
original.insert("user-agent", "AgentOne".parse().unwrap());
|
||||||
|
let original_ticket = ticket(&cache, &original);
|
||||||
|
|
||||||
|
let mut response = Response::new(Body::from("public-variant"));
|
||||||
|
*response.headers_mut() = headers("public, max-age=60");
|
||||||
|
response.headers_mut().insert(
|
||||||
|
"vary",
|
||||||
|
HeaderValue::from_static("Accept-Language, User-Agent"),
|
||||||
|
);
|
||||||
|
let policy = plan(
|
||||||
|
StatusCode::OK,
|
||||||
|
response.headers(),
|
||||||
|
&settings,
|
||||||
|
Duration::ZERO,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
cache
|
||||||
|
.wrap(response, original_ticket.clone(), policy, &settings)
|
||||||
|
.into_body()
|
||||||
|
.collect()
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let mut equivalent = HeaderMap::new();
|
||||||
|
equivalent.append("accept-language", HeaderValue::from_static("EN"));
|
||||||
|
equivalent.append("accept-language", HeaderValue::from_static("PL;q=0.500"));
|
||||||
|
equivalent.insert("user-agent", HeaderValue::from_static("AgentOne"));
|
||||||
|
let equivalent_ticket = ticket(&cache, &equivalent);
|
||||||
|
assert_eq!(original_ticket.key, equivalent_ticket.key);
|
||||||
|
let hit = cache.get(&equivalent_ticket).expect("semantically equivalent Vary HIT");
|
||||||
|
assert_eq!(
|
||||||
|
hit.response.into_body().collect().await.unwrap().to_bytes(),
|
||||||
|
Bytes::from_static(b"public-variant")
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut different = equivalent.clone();
|
||||||
|
different.insert("user-agent", HeaderValue::from_static("AgentTwo"));
|
||||||
|
assert!(cache.get(&ticket(&cache, &different)).is_none());
|
||||||
|
different.insert("user-agent", HeaderValue::from_static("AgentOne"));
|
||||||
|
different.insert("accept-language", HeaderValue::from_static("de"));
|
||||||
|
assert!(cache.get(&ticket(&cache, &different)).is_none());
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn canonical_identity_drops_accept_encoding_as_a_cache_variant() {
|
async fn canonical_identity_drops_accept_encoding_as_a_cache_variant() {
|
||||||
let cache = Cache::new(1);
|
let cache = Cache::new(1);
|
||||||
@@ -1272,6 +1410,7 @@ mod tests {
|
|||||||
let settings = Settings::default();
|
let settings = Settings::default();
|
||||||
assert!(settings.enabled);
|
assert!(settings.enabled);
|
||||||
assert!(settings.static_ignore_cookies);
|
assert!(settings.static_ignore_cookies);
|
||||||
|
assert!(settings.static_ignore_vary_cookie);
|
||||||
for path in [
|
for path in [
|
||||||
"/asset.jpg",
|
"/asset.jpg",
|
||||||
"/asset.jpeg",
|
"/asset.jpeg",
|
||||||
@@ -1302,6 +1441,115 @@ mod tests {
|
|||||||
Some("request_cookie")
|
Some("request_cookie")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
#[test]
|
||||||
|
fn static_vary_cookie_is_stripped_only_for_explicitly_public_cacheable_assets() {
|
||||||
|
let settings = Settings::default();
|
||||||
|
let mut h = headers("public, max-age=120");
|
||||||
|
h.append("vary", HeaderValue::from_static("Cookie, Accept-Language"));
|
||||||
|
h.append("vary", HeaderValue::from_static("X-Theme, cookie"));
|
||||||
|
assert!(normalize_static_cookie_vary(
|
||||||
|
StatusCode::OK, &mut h, &settings, Duration::ZERO, true,
|
||||||
|
&ResponseOverrides::NONE,
|
||||||
|
));
|
||||||
|
assert_eq!(h["vary"], "Accept-Language, X-Theme");
|
||||||
|
assert_eq!(
|
||||||
|
plan(StatusCode::OK, &h, &settings, Duration::ZERO).unwrap().vary,
|
||||||
|
vec!["accept-language".to_owned(), "x-theme".to_owned()]
|
||||||
|
);
|
||||||
|
assert!(!normalize_static_cookie_vary(
|
||||||
|
StatusCode::OK, &mut h, &settings, Duration::ZERO, true,
|
||||||
|
&ResponseOverrides::NONE,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn static_vary_cookie_never_overrides_privacy_or_malformed_vary() {
|
||||||
|
for (policy, has_cookie, vary) in [
|
||||||
|
("private, max-age=120", false, "Cookie"),
|
||||||
|
("public, no-store, max-age=120", false, "Cookie"),
|
||||||
|
("max-age=120", false, "Cookie"),
|
||||||
|
("public, max-age=120", true, "Cookie"),
|
||||||
|
("public, max-age=120", false, "Cookie, *"),
|
||||||
|
("public, max-age=120", false, "Cookie, Broken Header"),
|
||||||
|
("public", false, "Cookie"),
|
||||||
|
("public, max-age=0", false, "Cookie"),
|
||||||
|
] {
|
||||||
|
let settings = Settings::default();
|
||||||
|
let mut h = headers(policy);
|
||||||
|
h.insert("vary", vary.parse().unwrap());
|
||||||
|
if has_cookie { h.insert("set-cookie", HeaderValue::from_static("session=secret")); }
|
||||||
|
let original = h.clone();
|
||||||
|
assert!(!normalize_static_cookie_vary(
|
||||||
|
StatusCode::OK, &mut h, &settings, Duration::ZERO, true,
|
||||||
|
&ResponseOverrides::NONE,
|
||||||
|
), "{policy}, {vary}");
|
||||||
|
assert_eq!(h, original, "{policy}, {vary}");
|
||||||
|
}
|
||||||
|
let mut settings = Settings::default();
|
||||||
|
let mut h = headers("public, max-age=120");
|
||||||
|
h.insert("vary", HeaderValue::from_static("Cookie"));
|
||||||
|
settings.static_ignore_vary_cookie = false;
|
||||||
|
assert!(!normalize_static_cookie_vary(
|
||||||
|
StatusCode::OK, &mut h, &settings, Duration::ZERO, true,
|
||||||
|
&ResponseOverrides::NONE,
|
||||||
|
));
|
||||||
|
settings.static_ignore_vary_cookie = true;
|
||||||
|
assert!(!normalize_static_cookie_vary(
|
||||||
|
StatusCode::OK, &mut h, &settings, Duration::ZERO, false,
|
||||||
|
&ResponseOverrides::NONE,
|
||||||
|
));
|
||||||
|
assert!(!normalize_static_cookie_vary(
|
||||||
|
StatusCode::NOT_MODIFIED, &mut h, &settings, Duration::ZERO, true,
|
||||||
|
&ResponseOverrides::NONE,
|
||||||
|
));
|
||||||
|
assert_eq!(h["vary"], "Cookie");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn static_vary_cookie_requires_freshness_without_revalidation() {
|
||||||
|
let settings = Settings::default();
|
||||||
|
for (policy, age, needs_validator) in [
|
||||||
|
("public, max-age=120", Some("120"), false),
|
||||||
|
("public, no-cache, max-age=120", None, true),
|
||||||
|
] {
|
||||||
|
let mut h = headers(policy);
|
||||||
|
h.insert("vary", HeaderValue::from_static("Cookie"));
|
||||||
|
if let Some(age) = age {
|
||||||
|
h.insert("age", age.parse().unwrap());
|
||||||
|
}
|
||||||
|
if needs_validator {
|
||||||
|
h.insert("etag", HeaderValue::from_static("\"asset\""));
|
||||||
|
}
|
||||||
|
let original = h.clone();
|
||||||
|
assert!(!normalize_static_cookie_vary(
|
||||||
|
StatusCode::OK, &mut h, &settings, Duration::ZERO, true,
|
||||||
|
&ResponseOverrides::NONE,
|
||||||
|
), "{policy}");
|
||||||
|
assert_eq!(h, original, "{policy}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// A positive administrator-configured fallback does make `public`
|
||||||
|
// without an explicit max-age a reusable static response.
|
||||||
|
let mut settings = Settings::default();
|
||||||
|
settings.default_ttl_seconds = 60;
|
||||||
|
let mut h = headers("public");
|
||||||
|
h.insert("vary", HeaderValue::from_static("Cookie"));
|
||||||
|
assert!(normalize_static_cookie_vary(
|
||||||
|
StatusCode::OK, &mut h, &settings, Duration::ZERO, true,
|
||||||
|
&ResponseOverrides::NONE,
|
||||||
|
));
|
||||||
|
assert!(!h.contains_key("vary"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn static_vary_cookie_vhost_override_inherits_and_can_disable() {
|
||||||
|
let global = Settings::default();
|
||||||
|
let mut overrides = Overrides::default();
|
||||||
|
assert!(overrides.resolve(&global).unwrap().static_ignore_vary_cookie);
|
||||||
|
overrides.static_ignore_vary_cookie = Some(false);
|
||||||
|
assert!(!overrides.resolve(&global).unwrap().static_ignore_vary_cookie);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn age_uses_corrected_received_age_plus_response_delay_without_rounding_up() {
|
fn age_uses_corrected_received_age_plus_response_delay_without_rounding_up() {
|
||||||
let settings = settings();
|
let settings = settings();
|
||||||
|
|||||||
Vendored
+80
@@ -62,6 +62,86 @@ mod cold_tier_tests {
|
|||||||
panic!("cold tier did not persist in time");
|
panic!("cold tier did not persist in time");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn normalized_vary_keys_work_after_cold_demotion() {
|
||||||
|
let dir = tempfile::tempdir().unwrap();
|
||||||
|
let settings = cold_settings();
|
||||||
|
let shutdown = CancellationToken::new();
|
||||||
|
let cache = Cache::start(
|
||||||
|
11,
|
||||||
|
Some(dir.path().to_path_buf()),
|
||||||
|
settings.clone(),
|
||||||
|
shutdown.clone(),
|
||||||
|
);
|
||||||
|
let mut original = HeaderMap::new();
|
||||||
|
original.insert("accept-language", HeaderValue::from_static("en,pl;q=0.5"));
|
||||||
|
let original_ticket = cache
|
||||||
|
.ticket_scoped(
|
||||||
|
11,
|
||||||
|
"cold-test",
|
||||||
|
"http",
|
||||||
|
"cold.example",
|
||||||
|
"origin@127.0.0.1:8080",
|
||||||
|
"/vary-cold",
|
||||||
|
&original,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let mut response = Response::new(Body::from("cold-language-variant"));
|
||||||
|
response.headers_mut().insert(
|
||||||
|
"cache-control",
|
||||||
|
HeaderValue::from_static("public, max-age=120"),
|
||||||
|
);
|
||||||
|
response
|
||||||
|
.headers_mut()
|
||||||
|
.insert("vary", HeaderValue::from_static("Accept-Language"));
|
||||||
|
let policy = plan(StatusCode::OK, response.headers(), &settings, Duration::ZERO)
|
||||||
|
.expect("cacheable Vary response");
|
||||||
|
cache
|
||||||
|
.wrap(response, original_ticket, policy, &settings)
|
||||||
|
.into_body()
|
||||||
|
.collect()
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
fill(&cache, &settings, "/second", "demote-the-first-object").await;
|
||||||
|
wait_for_cold(&cache, 1).await;
|
||||||
|
|
||||||
|
let mut equivalent = HeaderMap::new();
|
||||||
|
equivalent.append("accept-language", HeaderValue::from_static("EN;q=1"));
|
||||||
|
equivalent.append("accept-language", HeaderValue::from_static("pl;q=0.500"));
|
||||||
|
let lookup = cache
|
||||||
|
.ticket_scoped(
|
||||||
|
11,
|
||||||
|
"cold-test",
|
||||||
|
"http",
|
||||||
|
"cold.example",
|
||||||
|
"origin@127.0.0.1:8080",
|
||||||
|
"/vary-cold",
|
||||||
|
&equivalent,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let hit = cache.get_tiered(&lookup, &settings).await.expect("COLD Vary HIT");
|
||||||
|
assert_eq!(
|
||||||
|
hit.response.into_body().collect().await.unwrap().to_bytes(),
|
||||||
|
Bytes::from_static(b"cold-language-variant")
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut different = HeaderMap::new();
|
||||||
|
different.insert("accept-language", HeaderValue::from_static("de"));
|
||||||
|
let mismatch = cache
|
||||||
|
.ticket_scoped(
|
||||||
|
11,
|
||||||
|
"cold-test",
|
||||||
|
"http",
|
||||||
|
"cold.example",
|
||||||
|
"origin@127.0.0.1:8080",
|
||||||
|
"/vary-cold",
|
||||||
|
&different,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert!(cache.get_tiered(&mismatch, &settings).await.is_none());
|
||||||
|
shutdown.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn upstream_cache_headers_survive_cold_demotion_and_hit_annotation() {
|
async fn upstream_cache_headers_survive_cold_demotion_and_hit_annotation() {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
|
|||||||
Vendored
+4
@@ -457,6 +457,7 @@ pub struct Overrides {
|
|||||||
pub bypass_query: Option<bool>,
|
pub bypass_query: Option<bool>,
|
||||||
pub bypass_prefixes: Option<Vec<String>>,
|
pub bypass_prefixes: Option<Vec<String>>,
|
||||||
pub static_ignore_cookies: Option<bool>,
|
pub static_ignore_cookies: Option<bool>,
|
||||||
|
pub static_ignore_vary_cookie: Option<bool>,
|
||||||
pub static_extensions: Option<Vec<String>>,
|
pub static_extensions: Option<Vec<String>>,
|
||||||
pub expose_status: Option<bool>,
|
pub expose_status: Option<bool>,
|
||||||
pub expose_hits: Option<bool>,
|
pub expose_hits: Option<bool>,
|
||||||
@@ -501,6 +502,9 @@ impl Overrides {
|
|||||||
if let Some(value) = self.static_ignore_cookies {
|
if let Some(value) = self.static_ignore_cookies {
|
||||||
result.static_ignore_cookies = value;
|
result.static_ignore_cookies = value;
|
||||||
}
|
}
|
||||||
|
if let Some(value) = self.static_ignore_vary_cookie {
|
||||||
|
result.static_ignore_vary_cookie = value;
|
||||||
|
}
|
||||||
if let Some(value) = &self.static_extensions {
|
if let Some(value) = &self.static_extensions {
|
||||||
result.static_extensions = value.clone();
|
result.static_extensions = value.clone();
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+199
-6
@@ -332,21 +332,214 @@ fn vary_names(headers: &HeaderMap) -> Option<Vec<String>> {
|
|||||||
(names.len() <= 64).then_some(names)
|
(names.len() <= 64).then_some(names)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RFC 9111 section 4.1 permits only semantics-preserving Vary comparisons.
|
||||||
|
// In particular, Cookie and arbitrary extension fields are NOT comma lists.
|
||||||
|
fn trim_vary_ows(mut value: &[u8]) -> &[u8] {
|
||||||
|
while value.first().is_some_and(|byte| matches!(*byte, b' ' | b'\t')) {
|
||||||
|
value = &value[1..];
|
||||||
|
}
|
||||||
|
while value.last().is_some_and(|byte| matches!(*byte, b' ' | b'\t')) {
|
||||||
|
value = &value[..value.len() - 1];
|
||||||
|
}
|
||||||
|
value
|
||||||
|
}
|
||||||
|
|
||||||
|
fn split_vary_unquoted(value: &[u8], separator: u8) -> Option<Vec<&[u8]>> {
|
||||||
|
let mut parts = Vec::new();
|
||||||
|
let mut start = 0;
|
||||||
|
let mut quoted = false;
|
||||||
|
let mut escaped = false;
|
||||||
|
for (index, &byte) in value.iter().enumerate() {
|
||||||
|
if quoted {
|
||||||
|
if escaped {
|
||||||
|
escaped = false;
|
||||||
|
} else if byte == b'\\' {
|
||||||
|
escaped = true;
|
||||||
|
} else if byte == b'"' {
|
||||||
|
quoted = false;
|
||||||
|
}
|
||||||
|
} else if byte == b'"' {
|
||||||
|
quoted = true;
|
||||||
|
} else if byte == separator {
|
||||||
|
parts.push(trim_vary_ows(&value[start..index]));
|
||||||
|
start = index + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if quoted || escaped {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
parts.push(trim_vary_ows(&value[start..]));
|
||||||
|
Some(parts)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_http_token(value: &[u8]) -> bool {
|
||||||
|
!value.is_empty()
|
||||||
|
&& value.iter().all(|byte| {
|
||||||
|
byte.is_ascii_alphanumeric() || b"!#$%&'*+-.^_`|~".contains(byte)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_language_range(value: &[u8]) -> bool {
|
||||||
|
if value == b"*" {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
let mut parts = value.split(|byte| *byte == b'-');
|
||||||
|
let Some(primary) = parts.next() else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
(1..=8).contains(&primary.len())
|
||||||
|
&& primary.iter().all(u8::is_ascii_alphabetic)
|
||||||
|
&& parts.all(|subtag| {
|
||||||
|
(1..=8).contains(&subtag.len()) && subtag.iter().all(u8::is_ascii_alphanumeric)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// qvalue is 0..1, expressed with at most three fractional digits (RFC 9110).
|
||||||
|
fn parse_vary_quality(value: &[u8]) -> Option<u16> {
|
||||||
|
let (&whole, rest) = value.split_first()?;
|
||||||
|
if whole != b'0' && whole != b'1' {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let fraction = if rest.is_empty() {
|
||||||
|
rest
|
||||||
|
} else if rest[0] == b'.' {
|
||||||
|
&rest[1..]
|
||||||
|
} else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
if fraction.len() > 3
|
||||||
|
|| !fraction.iter().all(u8::is_ascii_digit)
|
||||||
|
|| (whole == b'1' && fraction.iter().any(|digit| *digit != b'0'))
|
||||||
|
{
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
if whole == b'1' {
|
||||||
|
return Some(1000);
|
||||||
|
}
|
||||||
|
let mut result = 0;
|
||||||
|
for (digit, factor) in fraction.iter().zip([100, 10, 1]) {
|
||||||
|
result += u16::from(*digit - b'0') * factor;
|
||||||
|
}
|
||||||
|
Some(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn normalize_vary_weighted(name: &str, member: &[u8]) -> Option<Vec<u8>> {
|
||||||
|
let parts = split_vary_unquoted(member, b';')?;
|
||||||
|
if parts.is_empty() || parts.len() > 2 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let token = parts[0];
|
||||||
|
if !(if name == "accept-language" {
|
||||||
|
is_language_range(token)
|
||||||
|
} else {
|
||||||
|
is_http_token(token)
|
||||||
|
}) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let quality = if parts.len() == 2 {
|
||||||
|
let weight = parts[1];
|
||||||
|
if weight.len() < 2 || !weight[..2].eq_ignore_ascii_case(b"q=") {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
parse_vary_quality(&weight[2..])?
|
||||||
|
} else {
|
||||||
|
1000
|
||||||
|
};
|
||||||
|
let mut canonical = token.to_ascii_lowercase();
|
||||||
|
canonical.extend_from_slice(b";q=");
|
||||||
|
canonical.extend_from_slice(quality.to_string().as_bytes());
|
||||||
|
Some(canonical)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn normalize_vary_accept(member: &[u8]) -> Option<Vec<u8>> {
|
||||||
|
let parts = split_vary_unquoted(member, b';')?;
|
||||||
|
let media_range = *parts.first()?;
|
||||||
|
let slash = media_range.iter().position(|byte| *byte == b'/')?;
|
||||||
|
if !is_http_token(&media_range[..slash]) || !is_http_token(&media_range[slash + 1..]) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
// Media type/subtype is case-insensitive; parameter values need not be.
|
||||||
|
let mut canonical = media_range.to_ascii_lowercase();
|
||||||
|
for param in parts.iter().skip(1) {
|
||||||
|
if param.is_empty() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
canonical.push(b';');
|
||||||
|
canonical.extend_from_slice(param);
|
||||||
|
}
|
||||||
|
Some(canonical)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn normalize_vary_list(name: &str, values: &[&[u8]]) -> Option<Vec<u8>> {
|
||||||
|
let known_list = matches!(
|
||||||
|
name,
|
||||||
|
"accept" | "accept-charset" | "accept-encoding" | "accept-language"
|
||||||
|
| "cache-control" | "if-match" | "if-none-match" | "pragma" | "te"
|
||||||
|
);
|
||||||
|
if !known_list || values.is_empty() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let mut canonical = Vec::new();
|
||||||
|
let mut first = true;
|
||||||
|
for value in values {
|
||||||
|
// Commas inside a quoted-string are data, not list separators.
|
||||||
|
for member in split_vary_unquoted(value, b',')? {
|
||||||
|
let normalized = match name {
|
||||||
|
"accept-language" | "accept-encoding" | "accept-charset" => {
|
||||||
|
// Empty list elements are kept distinct. Never confuse an
|
||||||
|
// explicitly empty field with an absent header field.
|
||||||
|
if member.is_empty() {
|
||||||
|
Vec::new()
|
||||||
|
} else {
|
||||||
|
normalize_vary_weighted(name, member)?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"accept" if !member.is_empty() => normalize_vary_accept(member)?,
|
||||||
|
_ => member.to_vec(),
|
||||||
|
};
|
||||||
|
if !first {
|
||||||
|
canonical.push(b',');
|
||||||
|
}
|
||||||
|
first = false;
|
||||||
|
canonical.extend_from_slice(&normalized);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Some(canonical)
|
||||||
|
}
|
||||||
|
|
||||||
fn variant_key(base_key: &Key, vary: &[String], headers: &HeaderMap) -> Key {
|
fn variant_key(base_key: &Key, vary: &[String], headers: &HeaderMap) -> Key {
|
||||||
if vary.is_empty() {
|
if vary.is_empty() {
|
||||||
return *base_key;
|
return *base_key;
|
||||||
}
|
}
|
||||||
let mut digest = Sha256::new();
|
let mut digest = Sha256::new();
|
||||||
digest.update(b"RustProxy-Vary-v1");
|
// The v2 domain deliberately makes old COLD variant hashes miss instead
|
||||||
|
// of reusing entries that were indexed with the previous bytewise keys.
|
||||||
|
digest.update(b"RustProxy-Vary-v2");
|
||||||
digest.update(base_key);
|
digest.update(base_key);
|
||||||
for name in vary {
|
for name in vary {
|
||||||
digest.update((name.len() as u64).to_be_bytes());
|
digest.update((name.len() as u64).to_be_bytes());
|
||||||
digest.update(name.as_bytes());
|
digest.update(name.as_bytes());
|
||||||
let values = headers.get_all(name.as_str());
|
let header_values = headers.get_all(name.as_str());
|
||||||
digest.update((values.iter().count() as u64).to_be_bytes());
|
let values: Vec<&[u8]> = header_values.iter().map(HeaderValue::as_bytes).collect();
|
||||||
for value in values.iter() {
|
if let Some(value) = normalize_vary_list(name, &values) {
|
||||||
digest.update((value.as_bytes().len() as u64).to_be_bytes());
|
// Separate normalized values from raw fallback values: a malformed
|
||||||
digest.update(value.as_bytes());
|
// literal such as "gzip;q=1000" must not match canonical gzip.
|
||||||
|
digest.update([1_u8]);
|
||||||
|
// RFC 9110 allows combining multiple lines for known list fields.
|
||||||
|
digest.update(1_u64.to_be_bytes());
|
||||||
|
digest.update((value.len() as u64).to_be_bytes());
|
||||||
|
digest.update(&value);
|
||||||
|
} else {
|
||||||
|
// Unknown fields are opaque: no comma splitting, token case-folding
|
||||||
|
// or quote rewriting. Leading/trailing HTTP OWS is insignificant.
|
||||||
|
// The count also distinguishes an absent field from an empty one.
|
||||||
|
digest.update([0_u8]);
|
||||||
|
digest.update((values.len() as u64).to_be_bytes());
|
||||||
|
for value in values {
|
||||||
|
let value = trim_vary_ows(value);
|
||||||
|
digest.update((value.len() as u64).to_be_bytes());
|
||||||
|
digest.update(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
digest.finalize().into()
|
digest.finalize().into()
|
||||||
|
|||||||
Vendored
+2
@@ -170,6 +170,7 @@ pub struct Settings {
|
|||||||
pub bypass_prefixes: Vec<String>,
|
pub bypass_prefixes: Vec<String>,
|
||||||
pub http_invalidation_allowed_cidrs: Vec<String>,
|
pub http_invalidation_allowed_cidrs: Vec<String>,
|
||||||
pub static_ignore_cookies: bool,
|
pub static_ignore_cookies: bool,
|
||||||
|
pub static_ignore_vary_cookie: bool,
|
||||||
pub static_extensions: Vec<String>,
|
pub static_extensions: Vec<String>,
|
||||||
pub collapse_enabled: bool,
|
pub collapse_enabled: bool,
|
||||||
pub collapse_wait_timeout_ms: u64,
|
pub collapse_wait_timeout_ms: u64,
|
||||||
@@ -230,6 +231,7 @@ impl Default for Settings {
|
|||||||
bypass_prefixes: Vec::new(),
|
bypass_prefixes: Vec::new(),
|
||||||
http_invalidation_allowed_cidrs: Vec::new(),
|
http_invalidation_allowed_cidrs: Vec::new(),
|
||||||
static_ignore_cookies: true,
|
static_ignore_cookies: true,
|
||||||
|
static_ignore_vary_cookie: true,
|
||||||
static_extensions: vec![
|
static_extensions: vec![
|
||||||
"css", "js", "mjs", "cjs", "wasm", "png", "jpg", "jpeg", "jfif", "jxl", "gif",
|
"css", "js", "mjs", "cjs", "wasm", "png", "jpg", "jpeg", "jfif", "jxl", "gif",
|
||||||
"webp", "avif", "apng", "svg", "ico", "cur", "bmp", "tif", "tiff", "heic", "heif",
|
"webp", "avif", "apng", "svg", "ico", "cur", "bmp", "tif", "tiff", "heic", "heif",
|
||||||
|
|||||||
Vendored
+65
@@ -54,6 +54,71 @@ impl Plan {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// For cookie-independent static files only: remove Cookie from the Vary schema
|
||||||
|
/// presented to both RustProxy and downstream caches. A backend's public cache
|
||||||
|
/// policy must be explicit; private/Set-Cookie/no-store responses are untouched.
|
||||||
|
/// The caller is responsible for applying this only to configured static paths.
|
||||||
|
pub fn normalize_static_cookie_vary(
|
||||||
|
status: StatusCode,
|
||||||
|
headers: &mut HeaderMap,
|
||||||
|
settings: &Settings,
|
||||||
|
response_delay: Duration,
|
||||||
|
ignore_static_cookie: bool,
|
||||||
|
overrides: &ResponseOverrides,
|
||||||
|
) -> bool {
|
||||||
|
if !ignore_static_cookie
|
||||||
|
|| !settings.static_ignore_vary_cookie
|
||||||
|
|| !varies_on(headers, "cookie")
|
||||||
|
|| headers.contains_key(::http::header::SET_COOKIE)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let Some(control) = directives(headers) else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
if !control.contains_key("public")
|
||||||
|
|| control.contains_key("private")
|
||||||
|
|| control.contains_key("no-store")
|
||||||
|
|| control.contains_key("must-understand")
|
||||||
|
|| (settings.varnish_compatible && surrogate_no_store(headers))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut retained = Vec::new();
|
||||||
|
for field in headers.get_all(::http::header::VARY) {
|
||||||
|
let Ok(text) = field.to_str() else { return false; };
|
||||||
|
for part in text.split(',') {
|
||||||
|
let name = part.trim();
|
||||||
|
if name == "*" || name.parse::<http::HeaderName>().is_err() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if !name.eq_ignore_ascii_case("cookie") {
|
||||||
|
retained.push(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mut candidate = headers.clone();
|
||||||
|
candidate.remove(::http::header::VARY);
|
||||||
|
if !retained.is_empty() {
|
||||||
|
let Ok(value) = HeaderValue::from_str(&retained.join(", ")) else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
candidate.insert(::http::header::VARY, value);
|
||||||
|
}
|
||||||
|
// A response may have a storage plan with zero freshness (e.g. `public`
|
||||||
|
// with no fallback TTL, or `max-age=0`). Such a response must retain the
|
||||||
|
// origin's Vary: Cookie. The same applies when reuse needs revalidation.
|
||||||
|
let Some(plan) = plan_with(status, &candidate, settings, response_delay, overrides) else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
if plan.remaining_ttl() == 0 || plan.requires_revalidation {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*headers = candidate;
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
pub fn plan(
|
pub fn plan(
|
||||||
status: StatusCode,
|
status: StatusCode,
|
||||||
headers: &HeaderMap,
|
headers: &HeaderMap,
|
||||||
|
|||||||
@@ -348,6 +348,24 @@ fn apply_timing_headers(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Docker publications use "docker-<agent>-<service hash>/docker" internally.
|
||||||
|
// Keep those stable internal IDs for routing, logs, and metrics, but avoid
|
||||||
|
// repeating the Docker marker in the opt-in response diagnostic header.
|
||||||
|
fn backend_diagnostic_label(id: &str) -> std::borrow::Cow<'_, str> {
|
||||||
|
let Some(name) = id.strip_prefix("docker-").and_then(|id| id.strip_suffix("/docker")) else {
|
||||||
|
return std::borrow::Cow::Borrowed(id);
|
||||||
|
};
|
||||||
|
let Some((agent, hash)) = name.rsplit_once('-') else {
|
||||||
|
return std::borrow::Cow::Borrowed(id);
|
||||||
|
};
|
||||||
|
// The generated Docker vhost ID ends in a 12-character SHA-256 prefix.
|
||||||
|
// Do not rewrite ordinary or malformed backend identifiers.
|
||||||
|
if agent.is_empty() || hash.len() != 12 || !hash.bytes().all(|b| b.is_ascii_hexdigit()) {
|
||||||
|
return std::borrow::Cow::Borrowed(id);
|
||||||
|
}
|
||||||
|
std::borrow::Cow::Owned(format!("{agent}/{hash}"))
|
||||||
|
}
|
||||||
|
|
||||||
fn apply_backend_diagnostic_values(
|
fn apply_backend_diagnostic_values(
|
||||||
response: &mut Response,
|
response: &mut Response,
|
||||||
backend_header: bool,
|
backend_header: bool,
|
||||||
@@ -366,7 +384,7 @@ fn apply_backend_diagnostic_values(
|
|||||||
}
|
}
|
||||||
if backend_header {
|
if backend_header {
|
||||||
if let Some(origin) = response.extensions().get::<OriginBackend>() {
|
if let Some(origin) = response.extensions().get::<OriginBackend>() {
|
||||||
if let Ok(value) = HeaderValue::from_str(&origin.0) {
|
if let Ok(value) = HeaderValue::from_str(&backend_diagnostic_label(&origin.0)) {
|
||||||
response.headers_mut().insert(LEGACY_BACKEND, value);
|
response.headers_mut().insert(LEGACY_BACKEND, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ mod cache_fast_path_tests {
|
|||||||
response.headers_mut().insert(
|
response.headers_mut().insert(
|
||||||
"cache-control",
|
"cache-control",
|
||||||
HeaderValue::from_static(match parts.uri.path() {
|
HeaderValue::from_static(match parts.uri.path() {
|
||||||
"/private" => "private, max-age=600",
|
"/private" | "/vary-cookie-private.css" => "private, max-age=600",
|
||||||
"/backend-no-cache" | "/cache-headers-revalidate" => {
|
"/backend-no-cache" | "/cache-headers-revalidate" => {
|
||||||
"public, no-cache, max-age=600"
|
"public, no-cache, max-age=600"
|
||||||
}
|
}
|
||||||
@@ -484,7 +484,14 @@ mod cache_fast_path_tests {
|
|||||||
);
|
);
|
||||||
response
|
response
|
||||||
.headers_mut()
|
.headers_mut()
|
||||||
.insert("vary", HeaderValue::from_static("X-Variant"));
|
.insert("vary", HeaderValue::from_static(if parts.uri.path().starts_with("/vary-cookie") {
|
||||||
|
"Cookie, X-Variant"
|
||||||
|
} else {
|
||||||
|
"X-Variant"
|
||||||
|
}));
|
||||||
|
if parts.uri.path() == "/vary-cookie-set.css" {
|
||||||
|
response.headers_mut().insert("set-cookie", HeaderValue::from_static("session=private"));
|
||||||
|
}
|
||||||
response
|
response
|
||||||
.headers_mut()
|
.headers_mut()
|
||||||
.insert("content-type", HeaderValue::from_static("text/plain"));
|
.insert("content-type", HeaderValue::from_static("text/plain"));
|
||||||
@@ -518,6 +525,11 @@ mod cache_fast_path_tests {
|
|||||||
"authorization",
|
"authorization",
|
||||||
"x-request-id",
|
"x-request-id",
|
||||||
] {
|
] {
|
||||||
|
// Static asset responses in this fixture must not echo a
|
||||||
|
// request cookie into a publicly shared response header.
|
||||||
|
if name == "cookie" && parts.uri.path().starts_with("/vary-cookie") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if let Some(value) = parts.headers.get(name) {
|
if let Some(value) = parts.headers.get(name) {
|
||||||
let echoed: http::HeaderName = format!("x-seen-{name}").parse().unwrap();
|
let echoed: http::HeaderName = format!("x-seen-{name}").parse().unwrap();
|
||||||
response.headers_mut().insert(echoed, value.clone());
|
response.headers_mut().insert(echoed, value.clone());
|
||||||
@@ -920,6 +932,52 @@ mod cache_fast_path_tests {
|
|||||||
fixture.stop().await;
|
fixture.stop().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn public_static_vary_cookie_is_shared_but_other_vary_fields_remain() {
|
||||||
|
let origin = origin().await;
|
||||||
|
let mut config = config_for(origin.addr, true);
|
||||||
|
config.cache.static_ignore_cookies = true;
|
||||||
|
config.cache.static_ignore_vary_cookie = true;
|
||||||
|
let fixture = Fixture::new(config).await;
|
||||||
|
let first = fixture.get("/vary-cookie.css", &[("cookie", "session=alpha"), ("x-variant", "a")]).await;
|
||||||
|
assert_eq!(first.headers["x-cache"], "MISS");
|
||||||
|
assert_eq!(first.headers["vary"], "X-Variant");
|
||||||
|
assert_eq!(first.body, "origin-a");
|
||||||
|
let second = fixture.get("/vary-cookie.css", &[("cookie", "session=beta"), ("x-variant", "a")]).await;
|
||||||
|
assert_eq!(second.headers["x-cache"], "HIT");
|
||||||
|
assert_eq!(second.headers["vary"], "X-Variant");
|
||||||
|
assert_eq!(second.body, "origin-a");
|
||||||
|
let other = fixture.get("/vary-cookie.css", &[("cookie", "session=gamma"), ("x-variant", "b")]).await;
|
||||||
|
assert_eq!(other.headers["x-cache"], "MISS");
|
||||||
|
assert_eq!(other.body, "origin-b");
|
||||||
|
assert_eq!(origin.requests.load(Ordering::Relaxed), 2);
|
||||||
|
fixture.stop().await;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn static_vary_cookie_can_be_disabled_per_vhost_and_private_stays_private() {
|
||||||
|
let origin = origin().await;
|
||||||
|
let mut config = config_for(origin.addr, true);
|
||||||
|
config.cache.static_ignore_cookies = true;
|
||||||
|
config.cache.static_ignore_vary_cookie = true;
|
||||||
|
config.vhosts[0].cache.static_ignore_vary_cookie = Some(false);
|
||||||
|
let fixture = Fixture::new(config).await;
|
||||||
|
let first = fixture.get("/vary-cookie.css", &[("cookie", "session=alpha")]).await;
|
||||||
|
assert_eq!(first.headers["x-cache-reason"], "response_vary_cookie");
|
||||||
|
assert_eq!(first.headers["vary"], "Cookie, X-Variant");
|
||||||
|
let second = fixture.get("/vary-cookie.css", &[("cookie", "session=beta")]).await;
|
||||||
|
assert_eq!(second.headers["x-cache"], "MISS");
|
||||||
|
assert_eq!(origin.requests.load(Ordering::Relaxed), 2);
|
||||||
|
fixture.change(|config| { config.vhosts[0].cache.static_ignore_vary_cookie = None; }).await;
|
||||||
|
let private = fixture.get("/vary-cookie-private.css", &[]).await;
|
||||||
|
assert_eq!(private.headers["vary"], "Cookie, X-Variant");
|
||||||
|
assert_eq!(private.headers["x-cache"], "MISS");
|
||||||
|
let set_cookie = fixture.get("/vary-cookie-set.css", &[]).await;
|
||||||
|
assert_eq!(set_cookie.headers["vary"], "Cookie, X-Variant");
|
||||||
|
assert!(set_cookie.headers.contains_key("set-cookie"));
|
||||||
|
fixture.stop().await;
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn proxy_cache_on_preserves_vary_private_revalidation_and_ranges() {
|
async fn proxy_cache_on_preserves_vary_private_revalidation_and_ranges() {
|
||||||
let origin = origin().await;
|
let origin = origin().await;
|
||||||
|
|||||||
@@ -3,7 +3,12 @@ if response.status() == StatusCode::NOT_MODIFIED && revalidation_sent {
|
|||||||
if let (Some(ticket), Some(cached)) =
|
if let (Some(ticket), Some(cached)) =
|
||||||
(cache_ticket.as_ref(), cached_revalidation.as_ref())
|
(cache_ticket.as_ref(), cached_revalidation.as_ref())
|
||||||
{
|
{
|
||||||
let merged = cached.merge_validation_headers(response.headers());
|
let mut merged = cached.merge_validation_headers(response.headers());
|
||||||
|
crate::cache::normalize_static_cookie_vary(
|
||||||
|
StatusCode::OK, &mut merged, cache_settings,
|
||||||
|
upstream_started.elapsed(), ignore_static_cookie,
|
||||||
|
&crate::cache::ResponseOverrides::NONE,
|
||||||
|
);
|
||||||
let client_not_modified =
|
let client_not_modified =
|
||||||
crate::cache::conditional_not_modified(&client_conditionals, &merged);
|
crate::cache::conditional_not_modified(&client_conditionals, &merged);
|
||||||
let mut revalidated = if let Some(mut hit) = state.cache.publish_revalidated(
|
let mut revalidated = if let Some(mut hit) = state.cache.publish_revalidated(
|
||||||
|
|||||||
@@ -119,6 +119,11 @@ let cache_rule_overrides = match (&cache_rule_context, cache_ticket.is_some()) {
|
|||||||
if cache_rule_overrides.strip_set_cookie {
|
if cache_rule_overrides.strip_set_cookie {
|
||||||
response.headers_mut().remove(::http::header::SET_COOKIE);
|
response.headers_mut().remove(::http::header::SET_COOKIE);
|
||||||
}
|
}
|
||||||
|
let origin_status = response.status();
|
||||||
|
crate::cache::normalize_static_cookie_vary(
|
||||||
|
origin_status, response.headers_mut(), cache_settings,
|
||||||
|
upstream_started.elapsed(), ignore_static_cookie, &cache_rule_overrides,
|
||||||
|
);
|
||||||
let origin_plan = if cache_ticket.is_some()
|
let origin_plan = if cache_ticket.is_some()
|
||||||
&& !(ignore_static_cookie && crate::cache::varies_on(response.headers(), "cookie"))
|
&& !(ignore_static_cookie && crate::cache::varies_on(response.headers(), "cookie"))
|
||||||
{
|
{
|
||||||
@@ -171,6 +176,10 @@ if let Some(pool) = &route.pool {
|
|||||||
if let Some(cookie) = active_affinity_cookie {
|
if let Some(cookie) = active_affinity_cookie {
|
||||||
parts.headers.append(::http::header::SET_COOKIE, cookie);
|
parts.headers.append(::http::header::SET_COOKIE, cookie);
|
||||||
}
|
}
|
||||||
|
crate::cache::normalize_static_cookie_vary(
|
||||||
|
parts.status, &mut parts.headers, cache_settings,
|
||||||
|
upstream_started.elapsed(), ignore_static_cookie, &cache_rule_overrides,
|
||||||
|
);
|
||||||
let h3_tunnel = handshake.as_ref().is_some_and(|handshake| handshake.h3())
|
let h3_tunnel = handshake.as_ref().is_some_and(|handshake| handshake.h3())
|
||||||
&& upgraded.is_some();
|
&& upgraded.is_some();
|
||||||
let h2_bridge_tunnel = handshake.as_ref().is_some_and(|handshake| handshake.h2())
|
let h2_bridge_tunnel = handshake.as_ref().is_some_and(|handshake| handshake.h2())
|
||||||
@@ -400,5 +409,10 @@ if !range_requested && handshake.is_none() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let transformed_status = response.status();
|
||||||
|
crate::cache::normalize_static_cookie_vary(
|
||||||
|
transformed_status, response.headers_mut(), cache_settings,
|
||||||
|
upstream_started.elapsed(), ignore_static_cookie, &cache_rule_overrides,
|
||||||
|
);
|
||||||
(origin_validation_headers, origin_plan, origin_reason, response, cache_rule_overrides)
|
(origin_validation_headers, origin_plan, origin_reason, response, cache_rule_overrides)
|
||||||
}
|
}
|
||||||
@@ -206,6 +206,11 @@
|
|||||||
response.extensions_mut().insert(ResponseRulesApplied);
|
response.extensions_mut().insert(ResponseRulesApplied);
|
||||||
response.extensions_mut().insert(StaticSourceResponse);
|
response.extensions_mut().insert(StaticSourceResponse);
|
||||||
|
|
||||||
|
let response_status = response.status();
|
||||||
|
crate::cache::normalize_static_cookie_vary(
|
||||||
|
response_status, response.headers_mut(), cache_settings,
|
||||||
|
started.elapsed(), ignore_cookie, &crate::cache::ResponseOverrides::NONE,
|
||||||
|
);
|
||||||
let origin_eligible_plan = if origin_safe
|
let origin_eligible_plan = if origin_safe
|
||||||
&& !(ignore_cookie && crate::cache::varies_on(response.headers(), "cookie"))
|
&& !(ignore_cookie && crate::cache::varies_on(response.headers(), "cookie"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -482,6 +482,52 @@ mod authority_tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn docker_backend_diagnostic_header_is_short_but_retains_agent_and_service_identity() {
|
||||||
|
let mut response = Response::new(Body::empty());
|
||||||
|
let raw_id = "docker-edge-node-012345abcdef/docker";
|
||||||
|
response
|
||||||
|
.extensions_mut()
|
||||||
|
.insert(OriginBackend(raw_id.into()));
|
||||||
|
response
|
||||||
|
.extensions_mut()
|
||||||
|
.insert(OriginTiming(Duration::from_millis(7)));
|
||||||
|
|
||||||
|
// The header is opt-in, including for Docker-generated vhosts.
|
||||||
|
apply_backend_diagnostic_values(&mut response, false, false);
|
||||||
|
assert!(response.headers().get("x-rust-proxy-backend").is_none());
|
||||||
|
|
||||||
|
apply_backend_diagnostic_values(&mut response, true, true);
|
||||||
|
assert_eq!(response.headers()["x-rust-proxy-backend"], "edge-node/012345abcdef");
|
||||||
|
assert_eq!(response.headers()["x-rustproxy-backend-time"], "7.00ms");
|
||||||
|
assert_eq!(response.extensions().get::<OriginBackend>().unwrap().0, raw_id);
|
||||||
|
|
||||||
|
// For cached responses the same OriginBackend extension is used.
|
||||||
|
let mut cached = Response::new(Body::empty());
|
||||||
|
cached.extensions_mut().insert(OriginBackend(raw_id.into()));
|
||||||
|
apply_backend_diagnostic_values(&mut cached, true, false);
|
||||||
|
assert_eq!(cached.headers()["x-rust-proxy-backend"], "edge-node/012345abcdef");
|
||||||
|
assert!(cached.headers().get("x-rustproxy-backend-time").is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ordinary_and_unrecognized_backend_ids_are_not_rewritten() {
|
||||||
|
for id in [
|
||||||
|
"app-primary/backend-1",
|
||||||
|
"docker-edge-node-012345abcdef/backend-1",
|
||||||
|
"docker-edge-node-not-a-hash/docker",
|
||||||
|
"docker-edge-node-012345abcdeg/docker",
|
||||||
|
"docker--012345abcdef/docker",
|
||||||
|
"docker-edge-node-012345abcdef/docker#health",
|
||||||
|
] {
|
||||||
|
assert_eq!(backend_diagnostic_label(id).as_ref(), id);
|
||||||
|
}
|
||||||
|
assert_eq!(
|
||||||
|
backend_diagnostic_label("docker-docker-agent-012345abcdef/docker").as_ref(),
|
||||||
|
"docker-agent/012345abcdef"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn encoded_slash_routes_on_normalized_path_but_preserves_upstream_target() {
|
fn encoded_slash_routes_on_normalized_path_but_preserves_upstream_target() {
|
||||||
let config = crate::config::demo_config("127.0.0.1:9000".parse().unwrap());
|
let config = crate::config::demo_config("127.0.0.1:9000".parse().unwrap());
|
||||||
|
|||||||
@@ -56,11 +56,27 @@ pub(super) fn finish_web_revalidation(
|
|||||||
force_cache: bool,
|
force_cache: bool,
|
||||||
apply_rules: impl FnOnce(&mut HeaderMap),
|
apply_rules: impl FnOnce(&mut HeaderMap),
|
||||||
) -> Option<WebRevalidated> {
|
) -> Option<WebRevalidated> {
|
||||||
let origin_merged = web_merged_validation_headers(cached, validation);
|
let mut origin_merged = web_merged_validation_headers(cached, validation);
|
||||||
|
crate::cache::normalize_static_cookie_vary(
|
||||||
|
StatusCode::OK,
|
||||||
|
&mut origin_merged,
|
||||||
|
settings,
|
||||||
|
elapsed,
|
||||||
|
ignore_cookie,
|
||||||
|
&crate::cache::ResponseOverrides::NONE,
|
||||||
|
);
|
||||||
let origin_safe =
|
let origin_safe =
|
||||||
crate::cache::plan(StatusCode::OK, &origin_merged, settings, elapsed).is_some();
|
crate::cache::plan(StatusCode::OK, &origin_merged, settings, elapsed).is_some();
|
||||||
let mut merged = origin_merged;
|
let mut merged = origin_merged;
|
||||||
apply_rules(&mut merged);
|
apply_rules(&mut merged);
|
||||||
|
crate::cache::normalize_static_cookie_vary(
|
||||||
|
StatusCode::OK,
|
||||||
|
&mut merged,
|
||||||
|
settings,
|
||||||
|
elapsed,
|
||||||
|
ignore_cookie,
|
||||||
|
&crate::cache::ResponseOverrides::NONE,
|
||||||
|
);
|
||||||
if force_cache {
|
if force_cache {
|
||||||
if client.contains_key(::http::header::COOKIE) {
|
if client.contains_key(::http::header::COOKIE) {
|
||||||
merged.append(::http::header::VARY, HeaderValue::from_static("Cookie"));
|
merged.append(::http::header::VARY, HeaderValue::from_static("Cookie"));
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""Browser smoke test for the optional semantic SVG interface icons.
|
|
||||||
|
|
||||||
Uses a locally installed Chromium when available and otherwise exits successfully
|
|
||||||
with a skip message. It exercises the real index.html plus the embedded icon
|
|
||||||
module without requiring a running RustProxy backend.
|
|
||||||
"""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
import html
|
|
||||||
import re
|
|
||||||
import shutil
|
|
||||||
import subprocess
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parents[1]
|
|
||||||
WEB = ROOT / "src/admin/web"
|
|
||||||
chromium = next((shutil.which(name) for name in ("chromium", "chromium-browser", "google-chrome") if shutil.which(name)), None)
|
|
||||||
if not chromium:
|
|
||||||
print("Panel SVG icon browser smoke: SKIP (Chromium not installed)")
|
|
||||||
raise SystemExit(0)
|
|
||||||
|
|
||||||
page = (WEB / "index.html").read_text(encoding="utf-8")
|
|
||||||
page = re.sub(r'<script\s+defer=""\s+src="/assets/app___RUSTPROXY_ASSET_ID__\.js"></script>', "", page, count=1)
|
|
||||||
icons = (WEB / "app/icons.js").read_text(encoding="utf-8")
|
|
||||||
script = r'''
|
|
||||||
const $ = id => document.getElementById(id);
|
|
||||||
const translations = { edit: "Edit", remove: "Remove", copyValue: "Copy value", previous: "Previous", next: "Next" };
|
|
||||||
function t(key) { return translations[key] || key; }
|
|
||||||
''' + icons + r'''
|
|
||||||
(() => {
|
|
||||||
const fail = message => { document.getElementById("browser-icon-test").textContent = `FAIL: ${message}`; throw new Error(message); };
|
|
||||||
const result = document.getElementById("browser-icon-test");
|
|
||||||
const eligible = [...document.querySelectorAll("button, a.primary, a.outline, a.quiet")].filter(node => window.rustProxyIcons.iconFor(node) !== null);
|
|
||||||
if (document.querySelectorAll("svg.ui-icon").length !== 0) fail("icons must be absent before enabling the preference");
|
|
||||||
window.rustProxyIcons.setEnabled(true);
|
|
||||||
const decorated = eligible.filter(node => node.querySelector(":scope > svg.ui-icon"));
|
|
||||||
if (decorated.length !== eligible.length) fail(`expected ${eligible.length} decorated controls, got ${decorated.length}`);
|
|
||||||
if ([...document.querySelectorAll("svg.ui-icon")].some(icon => icon.getAttribute("aria-hidden") !== "true")) fail("SVG icons must be aria-hidden");
|
|
||||||
const expectedPanels = { overview: "grid", vhosts: "network", "web-server": "globe", "docker-vhosts": "box", redirects: "route", notfound: "fileX", streams: "transfer", "acl-profiles": "shield", tls: "certificate", traffic: "activity", cache: "database", transform: "wand", settings: "settings" };
|
|
||||||
for (const [panel, icon] of Object.entries(expectedPanels)) {
|
|
||||||
const button = document.querySelector(`[data-panel="${panel}"]`);
|
|
||||||
if (button?.querySelector(":scope > svg.ui-icon")?.dataset.uiIcon !== icon) fail(`panel ${panel} must use ${icon}`);
|
|
||||||
}
|
|
||||||
const dynamic = document.createElement("button"); dynamic.type = "button"; dynamic.className = "quiet"; dynamic.textContent = "Edit"; document.body.append(dynamic);
|
|
||||||
window.rustProxyIcons.refresh(dynamic);
|
|
||||||
if (dynamic.querySelector("svg.ui-icon")?.dataset.uiIcon !== "edit") fail("translated dynamic Edit action must use edit icon");
|
|
||||||
dynamic.textContent = "Remove item"; dynamic.setAttribute("aria-label", "Remove item"); window.rustProxyIcons.refresh(dynamic);
|
|
||||||
if (dynamic.querySelector("svg.ui-icon")?.dataset.uiIcon !== "trash") fail("dynamic Remove action must use trash icon");
|
|
||||||
const visibility = document.createElement("button"); visibility.dataset.dashboardWidgetAction = "toggle"; visibility.className = "dashboard-widget-toggle is-hidden"; document.body.append(visibility);
|
|
||||||
window.rustProxyIcons.refresh(visibility);
|
|
||||||
if (visibility.querySelector("svg.ui-icon")?.dataset.uiIcon !== "eyeOff") fail("hidden widget action must use eyeOff");
|
|
||||||
visibility.classList.remove("is-hidden"); window.rustProxyIcons.refresh(visibility);
|
|
||||||
if (visibility.querySelector("svg.ui-icon")?.dataset.uiIcon !== "eye") fail("visible widget action must use eye");
|
|
||||||
window.rustProxyIcons.setEnabled(false);
|
|
||||||
if (document.querySelectorAll("svg.ui-icon").length !== 0) fail("disabling preference must remove all injected icons");
|
|
||||||
result.textContent = `OK ${eligible.length} controls`;
|
|
||||||
})();
|
|
||||||
'''
|
|
||||||
page = page.replace("</body>", '<pre id="browser-icon-test">PENDING</pre><script>' + script + "</script></body>", 1)
|
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory(prefix="rustproxy-icons-") as tmp:
|
|
||||||
target = Path(tmp) / "icons-test.html"
|
|
||||||
target.write_text(page, encoding="utf-8")
|
|
||||||
try:
|
|
||||||
proc = subprocess.run(
|
|
||||||
[chromium, "--headless", "--no-sandbox", "--disable-gpu", "--disable-dev-shm-usage", "--virtual-time-budget=1000", "--dump-dom", target.as_uri()],
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
text=True,
|
|
||||||
timeout=8,
|
|
||||||
check=False,
|
|
||||||
)
|
|
||||||
except subprocess.TimeoutExpired:
|
|
||||||
print("Panel SVG icon browser smoke: SKIP (Chromium cannot start in this environment)")
|
|
||||||
raise SystemExit(0)
|
|
||||||
match = re.search(r'<pre id="browser-icon-test">([^<]+)</pre>', proc.stdout)
|
|
||||||
status = html.unescape(match.group(1)) if match else "missing result marker"
|
|
||||||
if proc.returncode != 0 or not status.startswith("OK "):
|
|
||||||
raise SystemExit(f"Panel SVG icon browser smoke failed: {status}\n{proc.stderr[-4000:]}")
|
|
||||||
print(f"Panel SVG icon browser smoke: {status}")
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
const assert = require("node:assert/strict");
|
|
||||||
const fs = require("node:fs");
|
|
||||||
const path = require("node:path");
|
|
||||||
|
|
||||||
const root = path.join(__dirname, "..");
|
|
||||||
const read = relative => fs.readFileSync(path.join(root, relative), "utf8");
|
|
||||||
const preferences = read("src/admin/web/app/preferences.js");
|
|
||||||
const icons = read("src/admin/web/app/icons.js");
|
|
||||||
const core = read("src/admin/web/app/core.js");
|
|
||||||
const html = read("src/admin/web/index.html");
|
|
||||||
const css = read("src/admin/web/css/10-base.css");
|
|
||||||
const overviewCss = read("src/admin/web/css/30-overview.css");
|
|
||||||
const integrations = read("src/admin/web/integrations.js");
|
|
||||||
const metricsPartial = read("src/admin/web/partials/overview-metrics.html");
|
|
||||||
const pl = JSON.parse(read("langs/pl_pl.json"));
|
|
||||||
const openapi = JSON.parse(read("src/admin/openapi.json"));
|
|
||||||
|
|
||||||
assert.match(html, /id="ui-interface-icons"[^>]*type="checkbox"/);
|
|
||||||
assert.match(preferences, /interface_icons:\s*false/);
|
|
||||||
assert.match(preferences, /applyAdminInterfaceIcons\(value\.interface_icons\)/);
|
|
||||||
assert.match(preferences, /saveAppearancePreference\(\{ interface_icons: next \}/);
|
|
||||||
assert.match(preferences, /interface:\s*\{[^}]*interface_icons:\s*false/);
|
|
||||||
assert.match(core, /rustProxyIcons\?\.refresh\?\.\(\)/);
|
|
||||||
assert.match(icons, /dataset\.interfaceIcons !== "true"/);
|
|
||||||
assert.match(icons, /aria-hidden", "true"/);
|
|
||||||
assert.match(icons, /data\.panel|dataset\.panel/);
|
|
||||||
assert.match(icons, /MutationObserver/);
|
|
||||||
assert.match(icons, /if \(target\.dataset\.httpSettingsTab\) return "network"/);
|
|
||||||
assert.match(icons, /#web-service-preset-apply.*return "wand"/);
|
|
||||||
assert.match(icons, /vhost-quick-toggle\.is-enable.*return "toggleOn"/);
|
|
||||||
assert.match(icons, /vhost-quick-toggle\.is-disable.*return "toggleOff"/);
|
|
||||||
assert.equal((html.match(/class="outline about-repository" data-ui-icon-name="none"/g) || []).length, 4);
|
|
||||||
assert.match(metricsPartial, /backend-latency-stat[\s\S]*backend-health-origins[\s\S]*backend-dashboard-latency-detail/);
|
|
||||||
assert.equal(JSON.parse(read("langs/en_US.json")).translations.backendWidgetProbeCount, "Health Origins");
|
|
||||||
assert.match(icons, /#tunnels-open.*return null/);
|
|
||||||
assert.match(icons, /#logs-menu > summary/);
|
|
||||||
assert.match(integrations, /listener-h2-settings-link.*uiIconName = "settings"/);
|
|
||||||
assert.match(integrations, /listener-h3-settings-link.*uiIconName = "settings"/);
|
|
||||||
assert.match(metricsPartial, /stat-corner-badge[^>]+data-ui-icon-name="none"[^>]+id="tunnels-open"/);
|
|
||||||
assert.match(overviewCss, /\.stat-corner-badge/);
|
|
||||||
assert.equal(pl.translations.interfaceIconsHelp, "Dodaje semantyczne ikony SVG do nawigacji, akcji, zakładek i okien dialogowych.");
|
|
||||||
assert.match(css, /html\[data-interface-icons="true"\]/);
|
|
||||||
assert.equal(openapi.components.schemas.AdminPreferences.properties.interface_icons.default, false);
|
|
||||||
assert.equal(openapi.components.schemas.AdminPreferences.properties.interface_icons.type, "boolean");
|
|
||||||
|
|
||||||
for (const icon of ["plus", "save", "check", "trash", "edit", "refresh", "settings", "search", "key", "certificate", "shield", "network", "database", "wand", "grid", "activity", "book", "toggleOn", "toggleOff"]) {
|
|
||||||
assert.ok(new RegExp(`\\b${icon}:`).test(icons), `missing semantic SVG icon definition: ${icon}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const explicitIcons = { "overview-layout-unlock": "unlock", "overview-inline-save": "lock", "overview-layout-open": "layers", "docker-settings-open": "settings", "login-submit": "login", "revoke-sessions": "logout", "about-open": "info" };
|
|
||||||
for (const [id, icon] of Object.entries(explicitIcons)) assert.match(icons, new RegExp(`"${id}": "${icon}"`), `${id} must use ${icon}`);
|
|
||||||
assert.match(icons, /\(\^\|\[\^p\]\)reset/, "preset buttons must not match the reset rule");
|
|
||||||
assert.match(icons, /UI_GLYPH_LABEL/);
|
|
||||||
assert.match(icons, /raw === key/, "English labels equal to their key must still count as translated");
|
|
||||||
for (const icon of ["unlock", "layers", "expand", "collapse", "ban", "eraser", "hash", "info", "plug", "transfer", "mapPin", "compare"]) {
|
|
||||||
assert.ok(new RegExp(`\\b${icon}:`).test(icons), `missing semantic SVG icon definition: ${icon}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const logo = read("src/admin/web/app/logo-animation.js");
|
|
||||||
const router = read("src/admin/router.rs");
|
|
||||||
const shellCss = read("src/admin/web/css/20-shell.css");
|
|
||||||
assert.match(html, /id="ui-logo-animation"[^>]*type="checkbox"/);
|
|
||||||
assert.match(router, /web\/app\/logo-animation\.js/);
|
|
||||||
assert.match(preferences, /logo_animation:\s*false/);
|
|
||||||
assert.match(preferences, /applyAdminLogoAnimation\(value\.logo_animation\)/);
|
|
||||||
assert.match(preferences, /saveAppearancePreference\(\{ logo_animation: next \}/);
|
|
||||||
assert.match(logo, /prefers-reduced-motion: reduce/);
|
|
||||||
assert.match(logo, /document\.hidden/);
|
|
||||||
assert.match(shellCss, /prefers-reduced-motion: reduce[\s\S]*data-logo-effect/);
|
|
||||||
assert.equal(openapi.components.schemas.AdminPreferences.properties.logo_animation.default, false);
|
|
||||||
assert.ok(pl.translations.logoAnimation && pl.translations.logoAnimationHelp);
|
|
||||||
|
|
||||||
const runtimeJs = read("src/admin/web/app/runtime.js");
|
|
||||||
const scalesJs = read("src/admin/web/app/chart-scales.js");
|
|
||||||
const editorsCss = read("src/admin/web/css/40-editors.css");
|
|
||||||
assert.match(runtimeJs, /row\.querySelector\("svg:not\(\.ui-icon\)"\)/);
|
|
||||||
assert.doesNotMatch(runtimeJs, /row\.querySelector\("svg"\)/);
|
|
||||||
assert.match(runtimeJs, /querySelector\(":scope > svg\.ui-icon"\)/);
|
|
||||||
assert.match(scalesJs, /svg\.classList\.contains\("ui-icon"\)/);
|
|
||||||
assert.match(scalesJs, /querySelectorAll\("svg:not\(\.ui-icon\)"\)/);
|
|
||||||
for (const source of [css, overviewCss, editorsCss]) assert.doesNotMatch(source, /(^|\n)[^\n{}]*(\.network-interface-row|\.stat-chart|\.activity-card|\.system-card|\.function-live-chart|\.mini-live-chart|\.vhost-chart|\.connection-card) svg[ ,{]/, "descendant chart svg rules must exclude .ui-icon");
|
|
||||||
assert.match(css, /html\[data-interface-icons="true"\] :is\(button, a, summary\)>svg\.ui-icon/);
|
|
||||||
assert.match(icons, /\.mobile-menu-toggle"\) return null|draft-dock-toggle, \.mobile-menu-toggle/);
|
|
||||||
|
|
||||||
assert.match(editorsCss, /\.vhost-backend-protocol-badge \{[^}]*letter-spacing: 1px;[^}]*\}/);
|
|
||||||
assert.match(editorsCss, /\.tls-pqc-control>a/);
|
|
||||||
|
|
||||||
console.log("Panel SVG icon preference contract: OK");
|
|
||||||
|
|
||||||
{
|
|
||||||
const cssDir = path.join(__dirname, "..", "src", "admin", "web", "css");
|
|
||||||
for (const name of fs.readdirSync(cssDir).filter((file) => file.endsWith(".css"))) {
|
|
||||||
assert.doesNotMatch(fs.readFileSync(path.join(cssDir, name), "utf8"), /body\[data-density/, `${name} still has legacy body[data-density] rules`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
const rt = fs.readFileSync(path.join(__dirname, "..", "src", "admin", "web", "app", "runtime.js"), "utf8");
|
|
||||||
assert.match(rt, /function fitCacheMixLabels/);
|
|
||||||
assert.match(rt, /segment\.textContent = mix && pct > 0/);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
const css = fs.readFileSync(path.join(__dirname, "..", "src", "admin", "web", "css", "50-settings.css"), "utf8");
|
|
||||||
assert.match(css, /#settings-page-appearance \.appearance-settings-grid>label \{/);
|
|
||||||
assert.match(css, /#panel-settings \.settings-tabs\.sub-tabs \{\s*display: flex;\s*flex-direction: row;/);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
const root = path.join(__dirname, "..");
|
|
||||||
const read = (file) => fs.readFileSync(path.join(root, file), "utf8");
|
|
||||||
const styles = ["default", "soft", "technical", "high_contrast", "neon", "monochrome", "warm", "cool", "sunset", "aurora", "ocean", "forest", "pastel", "terminal", "blueprint", "colorblind"];
|
|
||||||
const rust = read("src/admin/preferences.rs"), js = read("src/admin/web/app/preferences.js"), tokens = read("src/admin/web/css/00-tokens.css"), html = read("src/admin/web/index.html");
|
|
||||||
const openapi = JSON.parse(read("src/admin/openapi.json")).components.schemas;
|
|
||||||
const enumValues = JSON.stringify(openapi).match(/"chart_style":\{"type":"string","enum":(\[[^\]]*\])/);
|
|
||||||
assert.ok(enumValues, "chart_style enum must be present in OpenAPI");
|
|
||||||
const documented = JSON.parse(enumValues[1]);
|
|
||||||
for (const style of styles) {
|
|
||||||
assert.ok(documented.includes(style), `OpenAPI chart_style missing ${style}`);
|
|
||||||
assert.ok(rust.includes(`"${style}"`), `Rust validation missing ${style}`);
|
|
||||||
assert.ok(js.includes(`"${style}"`), `preferences.js missing ${style}`);
|
|
||||||
assert.ok(tokens.includes(`html[data-chart-style=${style}]`), `tokens missing ${style}`);
|
|
||||||
assert.ok(tokens.includes(`.chart-style-choice[data-chart-preset=${style}]`), `swatches missing ${style}`);
|
|
||||||
assert.ok(html.includes(`value="${style}"`), `selector missing ${style}`);
|
|
||||||
}
|
|
||||||
assert.equal(documented.length, styles.length, "OpenAPI chart_style enum must list exactly the supported styles");
|
|
||||||
}
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""Static integrity checks for the embedded administration interface.
|
|
||||||
|
|
||||||
The test intentionally uses only the Python standard library. It verifies the
|
|
||||||
actual HTML assembly and JavaScript files embedded by src/admin/router.rs; it is
|
|
||||||
not a replacement for Rust/browser integration tests.
|
|
||||||
"""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from collections import Counter
|
|
||||||
from pathlib import Path
|
|
||||||
import re
|
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parents[1]
|
|
||||||
WEB = ROOT / "src/admin/web"
|
|
||||||
ROUTER = (ROOT / "src/admin/router.rs").read_text(encoding="utf-8")
|
|
||||||
|
|
||||||
|
|
||||||
def assembled_html() -> str:
|
|
||||||
html = (WEB / "index.html").read_text(encoding="utf-8")
|
|
||||||
metrics = (WEB / "partials/overview-metrics.html").read_text(encoding="utf-8")
|
|
||||||
charts = (WEB / "partials/overview-charts.html").read_text(encoding="utf-8")
|
|
||||||
metrics_main, metrics_web = metrics.split("<!-- RP_METRICS_SPLIT -->", 1)
|
|
||||||
charts_main, charts_web = charts.split("<!-- RP_CHARTS_SPLIT -->", 1)
|
|
||||||
return (
|
|
||||||
html.replace("<!-- RP_METRICS_MAIN -->", metrics_main)
|
|
||||||
.replace("<!-- RP_METRICS_WEB -->", metrics_web)
|
|
||||||
.replace("<!-- RP_CHARTS_MAIN -->", charts_main)
|
|
||||||
.replace("<!-- RP_CHARTS_WEB -->", charts_web)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def embedded_app_sources() -> list[Path]:
|
|
||||||
start = ROUTER.index("fn admin_app_javascript()")
|
|
||||||
end = ROUTER.index("fn admin_vhosts_javascript()", start)
|
|
||||||
app_block = ROUTER[start:end]
|
|
||||||
paths = [WEB / rel for rel in re.findall(r'include_str!\("web/([^"\n]+\.js)"\)', app_block)]
|
|
||||||
|
|
||||||
vstart = end
|
|
||||||
vend = ROUTER.index("pub fn router", vstart)
|
|
||||||
vhost_block = ROUTER[vstart:vend]
|
|
||||||
vhost_paths = [WEB / rel for rel in re.findall(r'include_str!\("web/([^"\n]+\.js)"\)', vhost_block)]
|
|
||||||
|
|
||||||
result: list[Path] = []
|
|
||||||
for path in [*paths, *vhost_paths]:
|
|
||||||
if path not in result:
|
|
||||||
result.append(path)
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def attribute_values(html: str, name: str) -> set[str]:
|
|
||||||
return set(re.findall(rf'\b{re.escape(name)}=["\']([^"\']+)', html))
|
|
||||||
|
|
||||||
|
|
||||||
html = assembled_html()
|
|
||||||
ids = re.findall(r'\bid=["\']([^"\']+)', html)
|
|
||||||
duplicates = sorted(name for name, count in Counter(ids).items() if count > 1)
|
|
||||||
assert not duplicates, f"duplicate panel DOM ids: {duplicates}"
|
|
||||||
id_set = set(ids)
|
|
||||||
|
|
||||||
sources = embedded_app_sources()
|
|
||||||
assert sources, "no embedded administration JavaScript sources found"
|
|
||||||
missing_files = [str(path.relative_to(ROOT)) for path in sources if not path.is_file()]
|
|
||||||
assert not missing_files, f"missing embedded JS sources: {missing_files}"
|
|
||||||
|
|
||||||
literal_refs: dict[str, set[str]] = {}
|
|
||||||
patterns = [
|
|
||||||
re.compile(r'\$\(["\']([^"\']+)["\']\)'),
|
|
||||||
re.compile(r'document\.getElementById\(["\']([^"\']+)["\']\)'),
|
|
||||||
]
|
|
||||||
for path in sources:
|
|
||||||
source = path.read_text(encoding="utf-8")
|
|
||||||
for pattern in patterns:
|
|
||||||
for dom_id in pattern.findall(source):
|
|
||||||
literal_refs.setdefault(dom_id, set()).add(str(path.relative_to(ROOT)))
|
|
||||||
missing_refs = {dom_id: sorted(paths) for dom_id, paths in literal_refs.items() if dom_id not in id_set}
|
|
||||||
assert not missing_refs, f"embedded panel JS references missing DOM ids: {missing_refs}"
|
|
||||||
|
|
||||||
assert "ui-interface-icons" in id_set, "Appearance must expose the SVG icon toggle"
|
|
||||||
assert "ui-stable-dialog-position" in id_set, "Appearance must expose the stable dialog position toggle"
|
|
||||||
preferences_js = (WEB / "app/preferences.js").read_text(encoding="utf-8")
|
|
||||||
editors_css = (WEB / "css/40-editors.css").read_text(encoding="utf-8")
|
|
||||||
openapi = __import__("json").loads((ROOT / "src/admin/openapi.json").read_text(encoding="utf-8"))
|
|
||||||
pl = __import__("json").loads((ROOT / "langs/pl_pl.json").read_text(encoding="utf-8"))["translations"]
|
|
||||||
assert re.search(r"stable_dialog_position:\s*true", preferences_js), "stable dialog position must default on in the panel"
|
|
||||||
assert "applyAdminStableDialogPosition(value.stable_dialog_position)" in preferences_js
|
|
||||||
assert "saveAppearancePreference({ stable_dialog_position: next }" in preferences_js
|
|
||||||
assert 'html[data-stable-dialog-position="true"] dialog.vhost-dialog[open]' in editors_css
|
|
||||||
assert openapi["components"]["schemas"]["AdminPreferences"]["properties"]["stable_dialog_position"]["default"] is True
|
|
||||||
assert pl.get("stableDialogPosition") and pl.get("stableDialogPositionHelp")
|
|
||||||
assert "ui-switch-controls" in id_set, "Appearance must expose the switch controls toggle"
|
|
||||||
assert "ui-chart-tooltips" in id_set, "Appearance must expose the chart value tooltip toggle"
|
|
||||||
assert re.search(r"chart_tooltips:\s*false", preferences_js), "chart tooltips must default off in the panel"
|
|
||||||
assert "saveAppearancePreference({ chart_tooltips: next }" in preferences_js
|
|
||||||
assert openapi["components"]["schemas"]["AdminPreferences"]["properties"]["chart_tooltips"]["default"] is False
|
|
||||||
assert pl.get("chartTooltips") and pl.get("chartTooltipsHelp")
|
|
||||||
assert re.search(r"switch_controls:\s*true", preferences_js), "switch controls must default on in the panel"
|
|
||||||
assert "applyAdminSwitchControls(value.switch_controls)" in preferences_js
|
|
||||||
assert "saveAppearancePreference({ switch_controls: next }" in preferences_js
|
|
||||||
assert openapi["components"]["schemas"]["AdminPreferences"]["properties"]["switch_controls"]["default"] is True
|
|
||||||
assert pl.get("switchControls") and pl.get("switchControlsHelp")
|
|
||||||
assert any(path.name == "icons.js" for path in sources), "semantic icon module must be embedded in app.js"
|
|
||||||
|
|
||||||
assert 'data-i18n="overviewExtraRecentSamples"' not in html, "Overview metric tiles must not show the redundant Recent samples footer"
|
|
||||||
overview_extra = (WEB / "app/overview-extra-metrics.js").read_text(encoding="utf-8")
|
|
||||||
assert 't("overviewExtraRecentSamples")' not in overview_extra, "Overview metric details must not fall back to the generic Recent samples label"
|
|
||||||
|
|
||||||
# Every visible primary navigation target must have a panel section. filelogs is
|
|
||||||
# intentionally opened from the Logs menu rather than the main navigation.
|
|
||||||
panel_targets = attribute_values(html, "data-panel")
|
|
||||||
panel_sections = {value.removeprefix("panel-") for value in id_set if value.startswith("panel-")}
|
|
||||||
assert panel_targets <= panel_sections, f"navigation targets without panels: {sorted(panel_targets - panel_sections)}"
|
|
||||||
assert panel_sections - panel_targets <= {"filelogs"}, f"unexpected orphan panels: {sorted(panel_sections - panel_targets)}"
|
|
||||||
|
|
||||||
# Tab/page contracts used by the generic tab handlers in the embedded JS.
|
|
||||||
for prefix in ("settings", "policy-settings", "cache-settings", "logging-settings", "traffic"):
|
|
||||||
tabs = attribute_values(html, f"data-{prefix}-tab")
|
|
||||||
pages = attribute_values(html, f"data-{prefix}-page")
|
|
||||||
assert tabs == pages, f"{prefix} tab/page mismatch: tabs={sorted(tabs - pages)}, pages={sorted(pages - tabs)}"
|
|
||||||
|
|
||||||
print(
|
|
||||||
f"Panel interface contract: OK ({len(ids)} unique DOM ids, "
|
|
||||||
f"{len(literal_refs)} literal JS references, {len(sources)} embedded JS files)"
|
|
||||||
)
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
const assert = require("node:assert/strict");
|
|
||||||
const fs = require("node:fs");
|
|
||||||
const path = require("node:path");
|
|
||||||
|
|
||||||
const root = path.join(__dirname, "..");
|
|
||||||
const read = relative => fs.readFileSync(path.join(root, relative), "utf8");
|
|
||||||
|
|
||||||
const settings = read("src/admin/web/settings.js");
|
|
||||||
const certificateApi = read("src/admin/web/certificate-api.js");
|
|
||||||
const core = read("src/admin/web/app/core.js");
|
|
||||||
const cache = read("src/admin/web/cache-panel.js");
|
|
||||||
const transform = read("src/admin/web/transform-panel.js");
|
|
||||||
const traffic = read("src/admin/web/traffic-panel.js");
|
|
||||||
const refresh = read("src/admin/web/app/refresh.js");
|
|
||||||
const management = read("src/admin/web/management.js");
|
|
||||||
const loggingApi = read("src/admin/logging_api.rs");
|
|
||||||
const openapi = JSON.parse(read("src/admin/openapi.json"));
|
|
||||||
|
|
||||||
assert.match(settings, /authenticated && name === "certificate-api"[^\n]+rustProxyCertificateApi\?\.load/);
|
|
||||||
assert.match(settings, /authenticated && active === "certificate-api"[^\n]+rustProxyCertificateApi\?\.load/);
|
|
||||||
assert.ok(!/renderCertificateApi\(\);\s*loadCertificateApi\(\);\s*\}\)\(\);\s*$/.test(certificateApi),
|
|
||||||
"Certificate API must not fetch credentials when its module is initialized");
|
|
||||||
|
|
||||||
assert.match(core, /async function refresh\(force = false\)/);
|
|
||||||
assert.doesNotMatch(core, /includeLogs/);
|
|
||||||
assert.match(core, /new EventSource\(`\/api\/events\?interval=\$\{seconds\}&logs=false`\)/);
|
|
||||||
assert.match(loggingApi, /logs: Option<bool>/);
|
|
||||||
assert.match(loggingApi, /let include_logs = query\.logs\.unwrap_or\(true\)/);
|
|
||||||
assert.match(loggingApi, /if include_logs[\s\S]+logs_payload\(&state\)[\s\S]+else[\s\S]+live_status_payload/);
|
|
||||||
assert.match(core, /if \(payload\.logs\) renderLogs\(payload\.logs\)/);
|
|
||||||
|
|
||||||
assert.match(refresh, /active: \(\) => !!window\.rustProxyLogs\?\.active\?\.\(\)/);
|
|
||||||
assert.doesNotMatch(refresh, /manual\("logs-fallback"\).*manual\("system-info"\)/);
|
|
||||||
assert.match(management, /function active\(\) \{ return dialog\.open && !paused && !expanded; \}/);
|
|
||||||
assert.match(management, /syncLivePolling\(true\)/);
|
|
||||||
|
|
||||||
for (const [name, source, endpoint] of [
|
|
||||||
["cache", cache, "/api/cache"],
|
|
||||||
["transform", transform, "/api/transform"],
|
|
||||||
["traffic", traffic, "/api/traffic"],
|
|
||||||
]) {
|
|
||||||
assert.ok(/view=live/.test(source) || /set\(\"view\", \"live\"\)/.test(source), `${name} panel must use the lightweight polling view`);
|
|
||||||
assert.match(source, /data\.revision !== staticRevision/, `${name} panel must invalidate static data on config revision changes`);
|
|
||||||
assert.match(source, /reset\(\)[\s\S]{0,220}staticData = null[\s\S]{0,120}staticRevision = null/, `${name} panel reset must discard static cached API data`);
|
|
||||||
const operation = openapi.paths[endpoint].get;
|
|
||||||
const view = (operation.parameters || []).find(parameter => parameter.name === "view");
|
|
||||||
assert.deepEqual(view?.schema?.enum, ["live"], `${endpoint} must document view=live`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const events = openapi.paths["/api/events"].get;
|
|
||||||
const logsFlag = (events.parameters || []).find(parameter => parameter.name === "logs");
|
|
||||||
assert.equal(logsFlag?.schema?.type, "boolean");
|
|
||||||
assert.equal(logsFlag?.schema?.default, true);
|
|
||||||
assert.equal(openapi.info.version, "0.38.6");
|
|
||||||
console.log("Panel refresh/API contract checks: OK");
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
const assert = require("node:assert/strict");
|
|
||||||
const fs = require("node:fs");
|
|
||||||
const path = require("node:path");
|
|
||||||
const vm = require("node:vm");
|
|
||||||
|
|
||||||
const editor = fs.readFileSync(path.join(__dirname, "../src/admin/web/vhosts/editor.js"), "utf8");
|
|
||||||
const begin = editor.indexOf("const authMethodsByProvider = {");
|
|
||||||
const end = editor.indexOf("function load(value = defaults()", begin);
|
|
||||||
assert.ok(begin >= 0 && end > begin);
|
|
||||||
const values = new Map();
|
|
||||||
const context = vm.createContext({
|
|
||||||
str: key => values.get(key) || "",
|
|
||||||
yes: () => false,
|
|
||||||
num: () => 5,
|
|
||||||
nullable: () => null,
|
|
||||||
lines: () => []
|
|
||||||
});
|
|
||||||
const selection = vm.runInContext(editor.slice(begin, end) +
|
|
||||||
"\n({ authMethodsByProvider, inferredAuthentication, selectedAuthentication, readForwardProvider })", context);
|
|
||||||
const legacy = [
|
|
||||||
[{ basic_auth: { enabled: true } }, "basic", "basic"],
|
|
||||||
[{ tinyauth: { enabled: true } }, "tinyauth", "forward_auth"],
|
|
||||||
[{ authelia: { enabled: true } }, "authelia", "forward_auth"],
|
|
||||||
[{ authentik: { enabled: true } }, "authentik", "forward_auth"],
|
|
||||||
[{ oidc: { enabled: true } }, "custom", "oidc"],
|
|
||||||
[{}, "none", "none"]
|
|
||||||
];
|
|
||||||
for (const [vhost, provider, method] of legacy) {
|
|
||||||
const actual = selection.inferredAuthentication(vhost);
|
|
||||||
assert.equal(actual.provider, provider);
|
|
||||||
assert.equal(actual.method, method);
|
|
||||||
}
|
|
||||||
for (const provider of ["tinyauth", "authelia", "authentik", "pocket_id", "custom"]) {
|
|
||||||
const selected = { provider, method: "oidc" };
|
|
||||||
const actual = selection.inferredAuthentication({ authentication: selected, oidc: { enabled: true } });
|
|
||||||
assert.equal(actual.provider, provider);
|
|
||||||
assert.equal(actual.method, "oidc");
|
|
||||||
values.set("auth-provider", provider);
|
|
||||||
values.set("auth-method", "oidc");
|
|
||||||
assert.equal(selection.selectedAuthentication().method, "oidc");
|
|
||||||
for (const forward of ["authelia", "authentik"]) assert.equal(selection.readForwardProvider(forward).enabled, false);
|
|
||||||
}
|
|
||||||
for (const provider of ["authelia", "authentik"]) {
|
|
||||||
values.set("auth-provider", provider);
|
|
||||||
values.set("auth-method", "forward_auth");
|
|
||||||
assert.equal(selection.readForwardProvider(provider).enabled, true);
|
|
||||||
}
|
|
||||||
values.set("auth-provider", "none");
|
|
||||||
values.set("auth-method", "");
|
|
||||||
assert.equal(selection.selectedAuthentication().method, "none");
|
|
||||||
assert.deepEqual(Array.from(selection.authMethodsByProvider.pocket_id), ["oidc"]);
|
|
||||||
assert.deepEqual(Array.from(selection.authMethodsByProvider.basic), ["basic"]);
|
|
||||||
assert.deepEqual(Array.from(selection.authMethodsByProvider.authelia), ["forward_auth", "oidc"]);
|
|
||||||
console.log("Vhost provider/method UI selection checks: OK");
|
|
||||||
Reference in new issue
Block a user