This commit is contained in:
Mateusz Gruszczyński committed 2026-11-26 18:00:41 +01:00
1 parent 6afaf13b89
commit efc6eda4cd
15 files changed
+174 -41

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
# RustProxy source and documentation maintenance
Current source version: **0.42.3**. The Cargo package and binary are named `rust-proxy`.
Current source version: **0.42.4**. 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.
+6
View File
@@ -2,6 +2,12 @@
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.
## 0.42.4 — Vhost/global error pages for generated Web Server and Basic Auth failures
- **Web Server:** distinguish RustProxy-generated static and filesystem errors from PHP/FastCGI output and `.htaccess ErrorDocument` responses. Generated errors now use the configured Vhost error page, falling back to the global error page and then the Web Server built-in HTML. Application-provided error bodies remain unchanged unless explicitly selected in Vhost `intercept_statuses`.
- **Basic Auth:** 401, 403, 429 and 503 denials can use Vhost/global error HTML without bypassing security checks. Preserve `WWW-Authenticate`, `Retry-After` and private no-store caching. External authentication provider responses and redirects still bypass custom error pages.
- **Compatibility:** no JSON configuration migration or change to the default application-origin interception policy.
## 0.42.3 — Offline Cloudflare-style status pages
- **Page design and success-status hotfix:** show a single status code, label 200 as `HTTP 200` instead of an error, preserve bodyless HTTP 204 when enabling the bulk style, replace the RP mark with the official RustProxy SVG logo, and remove the decorative frame around the bulk switch. Add independent offline welcome/congratulations and placeholder choices in Settings, Vhosts and 404 hosts (existing status restrictions unchanged). The API accepts `cloudflare_welcome` and `cloudflare_placeholder`; old values and existing configurations remain compatible. Added regression tests and updated the generator and guides. Source-only patch; rebuild and run Rust tests before deployment.
Generated
+1 -1
View File
@@ -1914,7 +1914,7 @@ dependencies = [
[[package]]
name = "rust-proxy"
version = "0.42.3"
version = "0.42.4"
dependencies = [
"anyhow",
"arc-swap",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "rust-proxy"
version = "0.42.3"
version = "0.42.4"
edition = "2021"
rust-version = "1.99.1"
description = "RustProxy - independent reverse proxy with local administration"
+29 -29
View File
@@ -1,10 +1,10 @@
61bf40a0572889dc8b0dda9eae4e93e44b0de9364b3c798106c85700ffb37c23 .dockerignore
4140a2956264b44f259e6a37fc00ba02097bbe68b09296e04d3d243c1287129b .env.example
0a5e87541831edca0e7164c6469dba01a8a7053ab14dbfb8019c83e4db10edc2 .gitignore
6aa53a984cdecafd7615613b3f2eae9726144f9bc6e450d7f9efd8295d1db0ef AGENTS.md
485258b8d7fb31dfb1e8540557b2a72c49673b3a5e76fce64e0f7b4123b05579 CHANGELOG.md
1c8f3faa8c8ba133f78ff90e7bc5a590a3a277fff00a7c77babfdc0b5853cd58 Cargo.lock
9a0ed20f512cbc753fba1825e7e3934aa4e737c358887de64694e6123b228373 Cargo.toml
1c275142e27441c2f70c5361b1065f0cdf5fccf731eaf114a7b2bdf4ae23bd21 AGENTS.md
a7c78fde22738d685c4af12ab845cef5b86a8794189f489c5a228a97f05cfc72 CHANGELOG.md
193d722f4403a57494929392d1256fd73a33246a02edeab9143640b4b61b02ac Cargo.lock
d0a17bcb665bcd7814d41e24d7a462427c1b65ec837700aeedbe8d10b14703c1 Cargo.toml
788745d4f70a0382c6280020afbd48844bb2af65e835a826852143f8132cdeca Dockerfile
0d96a4ff68ad6d4b6f1f30f713b18d5184912ba8dd389f86aa7710db079abcb0 LICENSE
a8d456f1b84dbc5f412f7dda9b98b4e765578111d31e7b26027aeb83c26f3f54 README.md
@@ -38,7 +38,7 @@ d3ceee01252c1b7280a7f0d38828def899c3e3baeb62c27c7946fac23918c7f7 docker-agent/m
f30c895df3d7f289f3b7c9a73969009ecf91110f59cb247daa242f68e78aa014 docker-agent/server.go
20313df0c14a1696d099ed881b159fe854e92538a60548a1729f92babaead881 docker-agent/system.go
188b74ec4f58da1b46d86925a67b6a590c92fb4fd7516e8d03d43871bc3b4542 docker-agent/system_test.go
ab697cb3d7a9b2fb2be410d801e74e1b50b8103e29318ccf9def1c0c7ccfe160 docs/ACCESS.md
c4728da70d60d193c5c348d90c7c26ba1756d3459052a10a121f9be69a4dd18a docs/ACCESS.md
4359b18e07491d3388a8797633d18e3f2e1c4f3e7300850adc8eee048d66dd5b docs/API.md
728b15b9825f547f34c4121219784798dd046fbbdd72ece8906d0cd77e8efc64 docs/BACKUP.md
bfe96dd91dfc6e07918a662d98b036f12ceb011a5aa8381b3778bd0c964b19ab docs/CACHE.md
@@ -48,7 +48,7 @@ bfe96dd91dfc6e07918a662d98b036f12ceb011a5aa8381b3778bd0c964b19ab docs/CACHE.md
2cede323fe2767100258b5e1d3e3a8b362e2a91acf2b0ee61090c4a2db97d952 docs/CUSTOM_LOCATIONS.md
16d4510e38d43c3bbde9b7dab7af3aeb0cb837dc2f1956cfaad7a9a11bea3bfc docs/DASHBOARD.md
53cb0ce7db5ce25e4c2381de3a6e875d212deeed08861da63050de6c51a442bd docs/DOCKER_DISCOVERY.md
01c58be33a02f838e7b30ece3127df18744f7c3d35e0731759d407e1575b75f3 docs/ERROR_PAGES.md
279afcf0b5b8d2f8ef7b723ba0b5050ca4536f14445f3ee1b71e9f32b800bb9b docs/ERROR_PAGES.md
3e729724030fd38d2d77272fddbb6509b7cd971c6bf0e9e3ef234ad69e342156 docs/FASTCGI.md
01b6d461d6b17b321d63cfb51435814858b29b437ed3e0bb13aba4351eaaf735 docs/FEATURES.md
f7bb59821e0d6c45ae2a1789086fd9dab33d91c0ceae784ae68f64bd13b5f496 docs/HEADLESS.md
@@ -72,7 +72,7 @@ df83d07d7186a5eea60d206dee3cb62b7f6505a066d84141fc53130e2f29760b docs/TROUBLESH
4a5534b628c18f4e83c67c6136b60969c884391fbe55cc6bd4f2354711d8ffb7 docs/VCL_SUPPORT_MATRIX.md
382e084a1f9e35627ccb43eaf451c18fb6d0cc752397c2178108d71de592a931 docs/VCL_TRAFFIC_COOKBOOK.md
657720a2b093ba8c08c2bf2c01b02a0f95fd3c67751868d1d1cc1dbf31b633e5 docs/VHOSTS.md
0a624f8aa3e004ba37a93bbb13420db26837a9dd360f2bb672a4ed33e6931f0f docs/WEB_SERVER.md
e989bb6e00b9d92a92f4e5c8bfd19a1117b40f684f35ee8ae731857df1b57ba3 docs/WEB_SERVER.md
42822b1c9801bcadb0e2d785cb91883ca2df1da141222631f153030c95f5e197 docs/images/about.png
deff2393a987ac7102179dc85b48baf2c4a3882291bb8c7c584d760cc497c631 docs/images/api.png
74df8228ea6283004b3e87b4d297e43637371eb4a700b69c7248114c8670777a docs/images/cache.png
@@ -269,21 +269,21 @@ ba22ff211f408052aee0aa75a5a52734b1c257247e7112972aff75a9646faf22 src/admin/web/
433f5ccf0a4df1c4452f746f7b2f351f6712ee73873cb07204638c205e4f2c88 src/admin/web/cache-rules.js
6288b0a8228d828ac2e2535ace2d1aefd1c04011e789eb97f7279129874ac35c src/admin/web/certificate-api.js
acfdf7a31a7f3d1a7636125d724f9348ac397a1081344046e67fce2620e37fd6 src/admin/web/cf_page/README.md
b451834f933cc09583ee0401223fa826ea69943535e24b9700cb115ec2283339 src/admin/web/cf_page/error_200.html
110f0fc283a9803eb929a62b17bb935eafa3729c684c4ccd0a783ad1294d6185 src/admin/web/cf_page/error_400.html
44b67697ad9dab55f204ffaff76ea2b5344cd759d227081beeff79e2dfe920d1 src/admin/web/cf_page/error_401.html
90019ccd0485c009157d99bac6e6979a6fbc607d09b22be524805cbb0b200988 src/admin/web/cf_page/error_403.html
695cd2c96e19d7fc5076bdbd61ca37f29ad6f1ff3c04d259fac61b045f43d031 src/admin/web/cf_page/error_404.html
c6e865b0bfee0e2dcc2fe570bc81bcc269713067a36aa792b6058faaf83c128a src/admin/web/cf_page/error_408.html
f059f0c47f31b8b58104d1267ce291dc158f36168a109666bbdc8e39f09fdf88 src/admin/web/cf_page/error_410.html
671c7de4776e11bcf95886cc882edabfd426d43d9fe453cf691e4d18c53df588 src/admin/web/cf_page/error_413.html
d8e06e53074addedc9bfe6a39e60d0ab1b1d0539a32c31b848a7f0a21dcbbb42 src/admin/web/cf_page/error_429.html
dc7c4b2ef058fcf806e26d30b45f733812c05eb96f865ee6d83861c832cc10d4 src/admin/web/cf_page/error_500.html
f622ff59cc971bf2bcda5786e3a10a6607309b4efd00ab3feb9376e157ce2a45 src/admin/web/cf_page/error_502.html
f4f0e8eec39762bf263dcade63aa37110c483fcd9c8337e65f9f0ccfcbba8f5d src/admin/web/cf_page/error_503.html
ece171f4d6246d5c465bed1deddad4150c7225fc72efc99b5f1b4d0875b300c1 src/admin/web/cf_page/error_504.html
46d1dc7f2450075f5333dd44875c5f76094503cdd3a5e66f2ca0358e38b00fc3 src/admin/web/cf_page/placeholder.html
f0d06f462530aaa484a49763c5e00f0009b6e291469295c9209bd1b3418053bc src/admin/web/cf_page/welcome.html
9cafebce6eddc2a4b498a69ddb72a32d6ed781e3ccb072d8a6f13ee5c360f7c8 src/admin/web/cf_page/error_200.html
3ae7b7c41f7902be9c27585dccb0065114ebf96be2b25486a9a545f19384bcc2 src/admin/web/cf_page/error_400.html
8c81697b07a5653e5215f9c19d74691251571132afcb95e91e96574b675a38b5 src/admin/web/cf_page/error_401.html
65574f20bc961ac9577b754b76e595858537ccc6c6ccb85eea2a56435db6346e src/admin/web/cf_page/error_403.html
860e4760f79215089ffa5263c66220020628c9bdb93f796307e22f65e8e53ba8 src/admin/web/cf_page/error_404.html
3f2dffa34b43d0dbbf7a9a7b0fce403cfb77a058e736007eee6ec59551c01111 src/admin/web/cf_page/error_408.html
3ccaad1e6f16b3ab97f78bb8b96a5c48cecf3c23fbcc08d503626ed063b15461 src/admin/web/cf_page/error_410.html
85935d63a05ab891fd2beb5a43979a7189a684d00e0544b030b8ae7be7eb178b src/admin/web/cf_page/error_413.html
cb7f6f923d4b319284c86921ee1d6491c97fda87e30c06c6d9c397d213687567 src/admin/web/cf_page/error_429.html
2dcd0d1170e28113541cdd27d7bf62f845d2bb7f146e89cb9bcddaf2dff7a6c4 src/admin/web/cf_page/error_500.html
f0d3fd5a419a5cce2e181a404719445d1dfb107ccbbca3ac17f0b27f6696aefe src/admin/web/cf_page/error_502.html
eba1fb0a0bdce0fb6a8884c3fa446f2098b1fdeccb59da47b1c160899b986b0e src/admin/web/cf_page/error_503.html
e9cfe14e8e5093e8f8be504d9590643d71935846241f4e73ea4afcafb7f0f806 src/admin/web/cf_page/error_504.html
9efc37b434336db30333f28c09e14355c45332e1d28c64bb6b88f875ba9fd297 src/admin/web/cf_page/placeholder.html
38bb67d9ec6b6e08298d63267afa3a92cbc0818fb0a21fc39520afdca4a995e4 src/admin/web/cf_page/welcome.html
c2912a5e218896177776d4c5920e240092a3de66f9a4b95c1631796771e0ce3c src/admin/web/css/00-tokens.css
03fcd3917f84eb995bfea8ffebd261c90cae3733e26c2dcac2be3a7d5edd60ec src/admin/web/css/10-base.css
9cd9b62ff8cfba47cb180e29ea5f69b8e97c7817dfcfddcb55fc4e08d11a7184 src/admin/web/css/20-shell.css
@@ -380,7 +380,7 @@ ded4f445eec1caacd92fb1546f9eaeba1bc35fd164deb4d3142a64d0e9e261d9 src/balance/mo
5f9419176d5b927f8376d39b7dc4a6adf37b975835fedb35d82e7d6a2bb052fd src/balance/pool_selection.rs
d789bf40cf9433e2fd16409d112210fe93154588b1ac9bddc9c7f78e1db14426 src/balance/pool_view.rs
a361c341932ffd186c0b21356c91ab1fe8043f5020d40798266d15ae896a114e src/balance/tests.rs
c3c23be0df87cf49c85b78c27e18bda4aa92f8d1ba076155e42b51157c805b76 src/basic_auth/mod.rs
f85b967a926e0acb9dec733d028bcc36f3292a488ac460772b9043901185fcf0 src/basic_auth/mod.rs
2e0ad80a3fce45e02e1fc3920c3f49a7af41953fa4b64ceb602a47e9f5508882 src/basic_auth/tests.rs
d9c44f9be9e3855c2339d4867c164b35938474b0a970de887d3990f33779b03b src/cache/cache_regression_tests.rs
7def03ace07dc38a4806277d75b6ce673d33ddaaf1c4855fa0a3372be1cf9489 src/cache/cold.rs
@@ -501,7 +501,7 @@ c456b31ddd7a5c209073812b288f2cc150b5cdb0ed9372d4d1a9a84a74d706cd src/not_found/
c19998732c2d65b464f43d17a58644db5bcf7b4a6dd4c31a65a091c57692a5bb src/oidc/mod.rs
c4dbe0f8ded237d45b6a3977bdc7544296e4408996815cae9e28af028419d0b7 src/oidc/tests.rs
992f49379e44361d98088d8f8ca1013d62846a54a5a35c089a5e0e1a9488e08d src/oidc/token.rs
e05cc048830bf2ff47a3d95ef5372208be4bd0e043712b532e4a39280dd685e1 src/pages/mod.rs
9f853faba02c9a143d441946e839d5b604439ef0d5adab95fc9d074b7dc35489 src/pages/mod.rs
3ebf39c7e7de2ad794625e67937991b65adcf4e8c9978061f21ad891b2238aaa src/pages/tests.rs
9840ec5b3786661084fefdced6694f3c099fef1e872e28fab9ef9a5cef29d141 src/policy/compile.rs
420d3e1133621a6bab8c15523cbd81712ea4b5d36c1390d52d5ef703164850c9 src/policy/engine.rs
@@ -527,7 +527,7 @@ a86b10ce0707b51e925e11ea14f7f40fa108a196166f62cf40007a97f9e17203 src/proxy/cach
235388904f138367e30ea4c1d2123133d1d00591fd351f32f963fec3453aaf7d src/proxy/cache_plan/credential_tests.rs
19e3e0157c139cb05cd199ee8ea0d5f212a9b6c14aeb641bad81a7c456792f6a src/proxy/cache_plan/mod.rs
811a00b55b24638b4bf8a6bea9ed7c0ffe2a758f76bfe63a95e1d31bce1c2c9c src/proxy/cache_plan/tests.rs
2e1d34ff66f8c580f2058438ae4395813fe39df49899884da51940c64362e898 src/proxy/error_fallback.rs
86985cc07f7a16a6c18265dbcd37528dcafa8f39944d49cb94cfc2ab6b85aa00 src/proxy/error_fallback.rs
8d6edb93bd7e82577639509a675c6a387e04ea2d8a01a8ededf834995a42d54a src/proxy/error_fallback_policy_tests.rs
ff525886feef76d5fafcdfc68799a47b1c6a72651e6848ace7c3e5609793cbef src/proxy/forward/cache_fast_path_tests.rs
fdb3d0c1604a3cd829b1313dbeea20cc875ac5cd3fbff3686b37a2066ac6fb01 src/proxy/forward/cache_lookup.rs
@@ -539,10 +539,10 @@ ab27174e36fabe0b4e610a96be4a81de4b9d173ec60736ce5d6b51c1a8fa9826 src/proxy/forw
8beccb28fbee2a7d7df5991ce93a8610f7d92bd1d4abed8679b968861ebd8a1f src/proxy/forward/success_prepare.rs
a91d0bdc5740beec921df50ad14a4e85de0a73d46c9626c9cfd37a7f8baca317 src/proxy/forward/upstream.rs
03961ad0d386759ca2016d2dde37e124453514650d19a7feeaaa931f1ba81fc8 src/proxy/forward/vcl_policy_matrix_tests.rs
05c2f6762b96d72159704bcf67d22dd0242479244027da20ec4b339d9b0e5cc3 src/proxy/forward/web_source.rs
a1cea78b32c0c05e583f42c98d6387284fe096325a255e3df7f9b7051dad73dd src/proxy/forward/web_source.rs
3df1cd933c77e5390066e0bf3a4671a053b97ec1948c4a4204004312a3572c9d src/proxy/forward_entry.rs
9b25f5e3ea4443a63ee6f45d12e1957dd316fe8e85325fc00ea416faaab1025a src/proxy/h2_graceful.rs
fc61c3f81d0bd8d91dab2a72267d497404e45e10e5cfc6000af16a254f888148 src/proxy/headers/authority_tests.rs
3734ce8c3087d5906c412af872e83f1ed41816f121174db5b898aae49c2c5c53 src/proxy/headers/authority_tests.rs
e87437ccf80e50e0159d204dfdd1f8dc0739b6e375be192fce0af749810258cf src/proxy/headers/mod.rs
af9b044761a56e8a6dc57f9d760b289ff4a6bf37db11dbfcd3ec4da5b8f426b6 src/proxy/headers/tests.rs
2bc63579975387c92a9459a9677b4a49e76df382b1ee19de12c8341a3ead57e8 src/proxy/identity.rs
@@ -669,8 +669,8 @@ e5f5fbe702f66bfcbcbc1d1f3cd3d89bdbb929bb86aed94868a2a06a4b9e59e3 src/web_server
7da903c1a69be0ae6b85772b3208c518679efa8ed9d3e98adb694483518156b6 src/web_server/response/headers.rs
2665d4eac9a6430d68224874784cb65d9b9d424353af77735caf044401d08cb4 src/web_server/routing.rs
9e584eb4455a18641c2c89f9e9725745c93f32877abf0f0f2fbea9e3d5ef38c3 src/web_server/security.rs
add6e69fe51af4ce28004b056be1366a82a7426640feea64150c286d637993ad src/web_server/serve.rs
8c41430117399bcf835b4c7c95a40ef17a3e2e53ff63db9c68ca332d2e3bee06 src/web_server/tests.rs
0877d32e3315356147f417faf1841698513763435de958d9bb9824b200685a14 src/web_server/serve.rs
6f382b8a7afeb2c5b5bb0b9f26d5251a9463466eb16516b2d12b277492ee634b src/web_server/tests.rs
f00743af2cf4a5952caef7a1dcf68e7817b5599a252a9973e1c22045517c0b0e tests/fixtures/argon2id.json
9540e9a904455a2190c2d0a32b47b1345976e4c4618767ed2b55898d13da9987 tests/fixtures/balance_rendezvous_vectors.txt
affb5c728d2d2bd58807c080f22ac17575e06486c7cca38dc13cf58ad01873ae tests/fixtures/routing_conditions_cases.json
+1 -1
View File
@@ -57,7 +57,7 @@ New Vhosts store an explicit `authentication` choice; old Vhosts with only `tiny
- **Basic Auth:** protect selected Vhosts with configured credentials. Use HTTPS so credentials are not sent over plaintext. RustProxy performs memory-hard Argon2 verification for each HTTP request, including static assets. Up to two checks run simultaneously; additional checks wait in a bounded per-Vhost queue (64 queued requests, at most 3 seconds). When the queue is full or the deadline expires, RustProxy returns HTTP 503 with `Retry-After: 1` and logs a warning instead of silently dropping the request. A 401 means missing or invalid credentials, and 429 means too many failed attempts from one IP. If parallel assets fail with 503, inspect `error.log` for `Basic Auth` verification queue warnings rather than changing filesystem permissions or FastCGI sockets.
- **Tinyauth:** add a verification URL and an HTTPS login URL. RustProxy makes a bounded, body-free authorization request and can pass specifically allowed identity headers upstream. An origin URL automatically uses `/api/auth/nginx` (or set that path explicitly). This Nginx auth-request integration sends `X-Original-URL` and `X-Original-Method`, with a validated `X-Forwarded-For` and `X-Real-IP` for Tinyauth IP ACLs. It does **not** send `X-Forwarded-Host` or `X-Forwarded-URI` to the verifier, avoiding the `conflicting auth module headers` rejection introduced in Tinyauth 5.2.0 while keeping compatibility with earlier versions that implement the Nginx endpoint. Tinyauth has its own timeout and private-backend policy.
- **Provider-neutral gateway error pages:** One embedded `src/admin/web/error_auth_provider.html` template renders a self-contained HTML page for **Tinyauth, Authelia, authentik, and future providers**, using only the safe provider display name and the failure category. It replaces the three vendor-specific `error_tinyauth_*.html` source files while preserving the familiar Tinyauth response titles and statuses. For example: `502 Tinyauth connection error` if its HTTP client cannot reach Tinyauth (DNS/TCP/TLS/transport), `504 Tinyauth timeout` if the auth deadline expires, or `502 Tinyauth verification error` for unexpected verifier status or invalid/oversized data. The page always retains the HTTP error status, `Content-Type: text/html; charset=utf-8`, `Cache-Control: private, no-store` and `X-Content-Type-Options: nosniff`. Backend URLs, protocol errors and identity data are not shown to visitors. All of these cases **deny access** to the protected origin. HTTP `401`/`403` and configured login redirects remain unchanged. These auth-specific pages take precedence over custom Vhost/general HTTP error pages so the failure remains distinguishable. The generic failure marker also protects Basic Auth denials and provider login redirects from being replaced by Vhost pages. HTTPS-verifier transport errors are classified as connection failures, truncated/oversized/invalid verifier responses as verification failures, and verification deadlines as timeouts.
- **Provider-neutral gateway error pages:** One embedded `src/admin/web/error_auth_provider.html` template renders a self-contained HTML page for **Tinyauth, Authelia, authentik, and future providers**, using only the safe provider display name and the failure category. It replaces the three vendor-specific `error_tinyauth_*.html` source files while preserving the familiar Tinyauth response titles and statuses. For example: `502 Tinyauth connection error` if its HTTP client cannot reach Tinyauth (DNS/TCP/TLS/transport), `504 Tinyauth timeout` if the auth deadline expires, or `502 Tinyauth verification error` for unexpected verifier status or invalid/oversized data. The page always retains the HTTP error status, `Content-Type: text/html; charset=utf-8`, `Cache-Control: private, no-store` and `X-Content-Type-Options: nosniff`. Backend URLs, protocol errors and identity data are not shown to visitors. All of these cases **deny access** to the protected origin. HTTP `401`/`403` and configured login redirects remain unchanged. These auth-specific pages take precedence over custom Vhost/general HTTP error pages so the failure remains distinguishable. The provider failure marker protects external-auth denials and login redirects from being replaced by Vhost pages. Basic Auth denials (401, 403, 429, 503) instead use Vhost then global error pages when configured, retaining `WWW-Authenticate`, `Retry-After` and `Cache-Control: private, no-store`. HTTPS-verifier transport errors are classified as connection failures, truncated/oversized/invalid verifier responses as verification failures, and verification deadlines as timeouts.
- Point the verifier URL **directly** at the private Tinyauth service (for example `http://tinyauth:3000/api/auth/nginx`), rather than routing it through a second public proxy that might inject conflicting headers. Do not disable Tinyauth's header-spoofing protections. Confirm that Tinyauth trusts only the actual RustProxy address/network when enabling Tinyauth IP-based access controls (`TINYAUTH_AUTH_TRUSTEDPROXIES`).
- **Authelia:** select **Authelia → Forward Auth** under **Vhost → Authentication**. Enter the internal service origin (for example `http://authelia:9091`) and the public HTTPS login portal (for example `https://auth.example.com`); RustProxy calls `/api/authz/forward-auth`. It forwards trusted `X-Forwarded-*`, `X-Original-URL` and `X-Original-Method` metadata, verifies the provider result, returns provider-approved `302/303` login redirects only to the configured portal origin, and forwards configured `Remote-*` identity headers after stripping client-forged values. A `200` verifier response alone grants access. `401`/`403` deny; transport failures return 502 and timeouts 504. The Authelia `session.cookies` domains and `authelia_url` are defined in Authelia itself: protecting **unrelated registered domains** generally requires a login URL/cookie configuration within each domain, not one cookie from a single unrelated site.
- **authentik:** select **authentik → Forward Auth** and enter the private outpost origin (for example `http://authentik:9000`), not an `/if/flow` login URL. RustProxy calls `/outpost.goauthentik.io/auth/nginx`, forwards verified `X-Authentik-*` identity headers, and responds to a `401` with a same-origin login start at `/outpost.goauthentik.io/start?rd=...`. RustProxy reserves `/outpost.goauthentik.io` (and descendants) on the protected application hostname and forwards them to the configured outpost **without checking authentication again**, after ordinary global/Vhost IP/country/rate rules. No manual Custom Location is needed for that path. In authentik create a separate **Proxy Provider → Forward auth (single application)** for each protected external application URL, assign it to the serving outpost, then enable that Vhost's integration. Multiple unrelated domains can share the same authentik installation; they do **not** share a browser cookie across domains.
+1 -1
View File
@@ -46,4 +46,4 @@ For a welcome or placeholder response use `"kind": "cloudflare_welcome"` or `"ki
curl -i https://your-host.example/nonexistent
```
Check the actual HTTP status and response markup. For a 502 page, first configure interception or a matching generated error, then confirm the body shows `Bad gateway Error 502` and `RustProxy`. Re-test `401` with Basic Auth to ensure the challenge header remains. No Cloudflare account or public network access is needed.
Check the actual HTTP status and response markup. For a 502 page, first configure interception or a matching generated error, then confirm the body shows `Bad gateway Error 502` and `RustProxy`. Re-test `401` with Basic Auth to ensure the configured Vhost/global HTML is returned while `WWW-Authenticate` and `Cache-Control: private, no-store` remain. PHP/FastCGI and `.htaccess ErrorDocument` error bodies remain application-controlled unless explicitly listed in Vhost `intercept_statuses`; generated Web Server errors use configured error pages without enabling interception. No Cloudflare account or public network access is needed.
+1 -1
View File
@@ -95,7 +95,7 @@ These generated HTML responses retain the actual HTTP status, `Content-Type: tex
Since 0.42.3, **Settings → Pages** and **Vhost → Pages** can also select a pre-generated offline Cloudflare-style template for individual status responses, plus separate welcome and placeholder designs. These HTML/CSS files are in `src/admin/web/cf_page/` and are served by the same `include_str!` mechanism as existing built-in pages; nothing is read from disk at request time. See [Error pages](ERROR_PAGES.md) for selection, scope and limitations.
Vhosts can intercept selected application error bodies in **Pages** and return a configured HTML error page while preserving the status. Internal location `error_fallback` is different: it routes the error to a named internal handler. Error-page replacements are marked uncacheable. Origin-supplied and explicitly configured custom error bodies are preserved unless interception is enabled.
Vhosts can intercept selected application error bodies in **Pages** and return a configured HTML error page while preserving the status. Internal location `error_fallback` is different: it routes the error to a named internal handler. Error-page replacements are marked uncacheable. PHP/FastCGI responses and explicit `.htaccess ErrorDocument` bodies are preserved unless Vhost `intercept_statuses` explicitly includes their status. RustProxy-generated filesystem and Web Server error responses instead use Vhost then global error pages when configured, falling back to the built-in HTML body; `intercept_statuses` is not required for generated errors.
## Monitoring and issues
+3 -3
View File
@@ -162,9 +162,9 @@ fn denied(status: StatusCode, challenge: Option<&HeaderValue>) -> Response {
}),
);
}
response
.extensions_mut()
.insert(crate::auth_provider::AuthenticationResponse);
// Unlike external auth providers, a Basic Auth denial may use the
// configured Vhost/global error document. The challenge and retry
// headers are retained by pages::replace_error.
response
}
+15
View File
@@ -312,6 +312,21 @@ pub fn replace_error(response: &mut Response, page: &Page) {
replacement.headers_mut().append(name, value.clone());
}
}
// Authentication challenges must never become shared-cache entries.
if response
.headers()
.get(::http::header::CACHE_CONTROL)
.is_some_and(|value| value.as_bytes().split(|&byte| byte == b',').any(|part|
part.iter().copied().filter(|byte| !byte.is_ascii_whitespace())
.map(|byte| byte.to_ascii_lowercase())
.eq(b"private".iter().copied())
))
{
replacement.headers_mut().insert(
::http::header::CACHE_CONTROL,
HeaderValue::from_static("private, no-store"),
);
}
*response = replacement;
}
pub fn intercept_application_error(
+19
View File
@@ -251,5 +251,24 @@ fn intercept_route_origin_error(
response
}
// Web Server responses are not necessarily origin responses. PHP/FastCGI and
// local .htaccess ErrorDocument responses carry OriginProvidedResponse from
// web_server::serve; generated filesystem errors do not.
fn intercept_route_web_error(
response: Response,
route: &crate::config::CompiledRoute,
snapshot: &crate::config::Snapshot,
) -> Response {
if response
.extensions()
.get::<crate::pages::OriginProvidedResponse>()
.is_some()
{
intercept_route_origin_error(response, route, snapshot)
} else {
response
}
}
#[cfg(test)]
include!("error_fallback_policy_tests.rs");
+3 -3
View File
@@ -123,7 +123,7 @@
}
response.extensions_mut().insert(ResponseRulesApplied);
response.extensions_mut().insert(StaticSourceResponse);
return intercept_route_origin_error(response, route, &snapshot);
return intercept_route_web_error(response, route, &snapshot);
}
}
}
@@ -164,7 +164,7 @@
response.status(), &fallback_request, &fallback_body,
).await { return fallback; }
let mut response = intercept_route_origin_error(response, route, &snapshot);
let mut response = intercept_route_web_error(response, route, &snapshot);
if revalidation_sent && response.status() == StatusCode::NOT_MODIFIED {
if let (Some(ticket), Some(cached)) =
(cache_ticket.as_ref(), cached_revalidation.as_ref())
@@ -183,7 +183,7 @@
}
hit.response.extensions_mut().insert(ResponseRulesApplied);
hit.response.extensions_mut().insert(StaticSourceResponse);
return intercept_route_origin_error(hit.response, route, &snapshot);
return intercept_route_web_error(hit.response, route, &snapshot);
}
return error(StatusCode::SERVICE_UNAVAILABLE,
"RustProxy: Web Server cache entry invalidated during revalidation\n");
+79
View File
@@ -838,4 +838,83 @@ async fn proxy_generated_error_responses_use_generic_statuses() {
let page = std::str::from_utf8(&bytes).unwrap();
assert!(page.contains("404"));
assert!(!page.contains("RustProxy: internal"));
#[tokio::test]
async fn generated_web_errors_use_vhost_then_global_but_origin_errors_keep_their_body() {
use http_body_util::BodyExt;
let mut config = crate::config::demo_config("127.0.0.1:9000".parse().unwrap());
config.pages.errors.insert(404, crate::pages::Page {
kind: crate::pages::Kind::Html,
status: None,
html: "global 404".into(),
});
let snapshot = crate::config::compile(config.clone(), 1, &validation_policy()).unwrap();
let route = snapshot.select("localhost", "/").unwrap();
let generated = Response::builder().status(404)
.body(Body::from("generated Web Server 404")).unwrap();
let mut generated = intercept_route_web_error(generated, route, &snapshot);
assert!(should_replace_error_page(&generated, false));
crate::pages::replace_error(&mut generated, &snapshot.envelope.config.pages.errors[&404]);
assert_eq!(generated.into_body().collect().await.unwrap().to_bytes(), "global 404");
config.vhosts[0].pages.errors.insert(404, crate::pages::Page {
kind: crate::pages::Kind::Html,
status: None,
html: "vhost 404".into(),
});
let snapshot = crate::config::compile(config.clone(), 2, &validation_policy()).unwrap();
let route = snapshot.select("localhost", "/").unwrap();
let generated = Response::builder().status(404)
.body(Body::from("generated Web Server 404")).unwrap();
let mut generated = intercept_route_web_error(generated, route, &snapshot);
assert!(should_replace_error_page(&generated, false));
crate::pages::replace_error(&mut generated, &route.frontend.as_ref().unwrap().pages.errors[&404]);
assert_eq!(generated.into_body().collect().await.unwrap().to_bytes(), "vhost 404");
for source in ["PHP/FastCGI", "htaccess ErrorDocument"] {
let mut response = Response::builder().status(404)
.body(Body::from(source)).unwrap();
response.extensions_mut().insert(crate::pages::OriginProvidedResponse);
let response = intercept_route_web_error(response, route, &snapshot);
assert!(!should_replace_error_page(&response, false));
assert_eq!(response.into_body().collect().await.unwrap().to_bytes(), source);
}
config.vhosts[0].pages.intercept_statuses = vec![404];
let snapshot = crate::config::compile(config, 3, &validation_policy()).unwrap();
let route = snapshot.select("localhost", "/").unwrap();
let mut response = Response::builder().status(404)
.body(Body::from("application 404")).unwrap();
response.extensions_mut().insert(crate::pages::OriginProvidedResponse);
let response = intercept_route_web_error(response, route, &snapshot);
assert!(!should_replace_error_page(&response, false));
assert_eq!(response.into_body().collect().await.unwrap().to_bytes(), "vhost 404");
}
#[tokio::test]
async fn basic_auth_denials_keep_challenge_retry_and_private_cache_with_custom_page() {
use http_body_util::BodyExt;
for (status, challenge, retry) in [
(StatusCode::UNAUTHORIZED, Some("Basic realm=\"Restricted\""), None),
(StatusCode::TOO_MANY_REQUESTS, None, Some("60")),
(StatusCode::SERVICE_UNAVAILABLE, None, Some("1")),
] {
let mut response = Response::builder().status(status)
.header("cache-control", "private, no-store")
.body(Body::from("basic auth failure")).unwrap();
if let Some(value) = challenge { response.headers_mut().insert("www-authenticate", value.parse().unwrap()); }
if let Some(value) = retry { response.headers_mut().insert("retry-after", value.parse().unwrap()); }
assert!(should_replace_error_page(&response, false));
crate::pages::replace_error(&mut response, &crate::pages::Page {
kind: crate::pages::Kind::Html,
status: None,
html: "custom auth page".into(),
});
assert_eq!(response.status(), status);
assert_eq!(response.headers().get("cache-control").unwrap(), "private, no-store");
assert_eq!(response.headers().get("www-authenticate").map(|v| v.to_str().unwrap()), challenge);
assert_eq!(response.headers().get("retry-after").map(|v| v.to_str().unwrap()), retry);
assert_eq!(response.into_body().collect().await.unwrap().to_bytes(), "custom auth page");
}
}
}
+13
View File
@@ -463,6 +463,19 @@ pub async fn serve(
}
}
}
// Keep application-generated errors and explicit local ErrorDocument bodies.
// Static filesystem errors are generated by RustProxy and may be replaced
// by Vhost/global pages in the outer HTTP response pipeline.
if used_local_error_document
|| matches!(
response.extensions().get::<crate::web_server::metrics::ResponseKind>(),
Some(crate::web_server::metrics::ResponseKind::Php)
)
{
response
.extensions_mut()
.insert(crate::pages::OriginProvidedResponse);
}
if request_method == Method::HEAD {
*response.body_mut() = Body::empty();
}
+1
View File
@@ -119,6 +119,7 @@ async fn missing_files_and_disabled_directory_listing_return_normal_errors() {
)
.await;
assert_eq!(missing.status(), StatusCode::NOT_FOUND);
assert!(missing.extensions().get::<crate::pages::OriginProvidedResponse>().is_none());
assert_eq!(missing.headers()[CACHE_CONTROL], "no-store");
assert_eq!(missing.headers()[CONTENT_TYPE], "text/html; charset=utf-8");
assert_eq!(missing.headers()["x-content-type-options"], "nosniff");