v0.42.2_fix2

This commit is contained in:
Mateusz Gruszczyński committed 2026-11-26 12:31:28 +01:00
1 parent 15c7f9ff9e
commit 25148f26eb
14 files changed
+407 -54

No files matched your search

+21 -3
View File
@@ -5,7 +5,7 @@ The built-in Web Server serves local files and can forward executable scripts to
## Create a Web Service
1. Open **Web Server → New Web Service**. Choose an ID/name and an absolute document root readable by the RustProxy service account.
2. Set index files (default `index.html`, `index.htm`), whether directory listing is allowed (off by default), MIME handling and download extensions.
2. Set index files (static default `index.html`, `index.htm`; when PHP-FPM for `.php` is enabled with that unchanged default, `index.php` is also tried last), whether directory listing is allowed (off by default), MIME handling and download extensions.
3. Add `try_files`, rewrites and response headers only if your application requires them. VCL-style cache rules (including `pass` / `cookie_pass`) are **not** evaluated for Web Server sources; the static-extension Cookie option and the regular cache policy still apply to local files.
4. Enable FastCGI only if you have a reachable, protected external PHP-FPM pool, CGI runner or compatible FastCGI responder; otherwise static files do not need an executable runtime.
5. Save, create or edit a **Vhost**, select **Web Server** as source and choose the service ID.
@@ -57,9 +57,27 @@ The editor supports common website presets to fill suggested fields; review thei
An optional bounded Apache-style `.htaccess` compatibility layer supports a **subset** of rules useful for migrations, not arbitrary Apache modules or dynamic directive execution. It can scan configured paths and enforce stricter handling of unsupported expressions. Prefer explicit `try_files`/rewrite/header controls when possible and test migrated sites. A real Apache configuration cannot be pasted unchanged into RustProxy.
With **Strict unsupported-directive mode disabled**, harmless unimplemented directives (such as `ErrorDocument` and unsupported `Options` tokens) are skipped and logged as warnings during Web Service validation/apply; inspect the server logs or expand **Skipped .htaccess directives** on the Web Service card for file/line locations. They do **not** become active Apache functionality. Unsupported security/handler syntax is still rejected to avoid unintentionally exposing protected content.
With **Strict unsupported-directive mode disabled**, unimplemented directives (such as unsupported `Options` tokens) are skipped and logged as warnings during Web Service validation/apply; inspect the server logs or expand **.htaccess compatibility warnings** on the Web Service card for file/line locations. They do **not** become active Apache functionality. Unsupported security/handler syntax is still rejected to avoid unintentionally exposing protected content.
`RedirectMatch 404 /\.` is accepted as a **status-only rule**: a matching request returns HTTP 404 without a `Location` header. `Redirect gone /old` and `RedirectMatch 410 <regex>` similarly return HTTP 410, while ordinary `Redirect 301 /old /new` and `RedirectMatch 302 <regex> /replacement` retain redirect behavior. This works without `RewriteEngine`. Safety filters for protected paths still run before rewrites and can return 403 for a hidden or otherwise forbidden file. `ErrorDocument`, unsupported `Options` values and `AcceptPathInfo` are still skipped with warnings when Strict is off; they do **not** enable their Apache semantics. If your application needs PHP `PATH_INFO`, enable it in the FastCGI Web Service settings instead; see [FastCGI](FASTCGI.md).
`RedirectMatch 404 /\.` is accepted as a **status-only rule**: a matching request returns HTTP 404 without a `Location` header. `Redirect gone /old` and `RedirectMatch 410 <regex>` similarly return HTTP 410, while ordinary `Redirect 301 /old /new` and `RedirectMatch 302 <regex> /replacement` retain redirect behavior. This works without `RewriteEngine`. Safety filters for protected paths still run before rewrites and can return 403 for a hidden or otherwise forbidden file.
**PHP routing using `.htaccess`:** `RewriteEngine`, `RewriteBase` (absolute safe URL prefix), `RewriteCond` and `RewriteRule` are active. `AcceptPathInfo On` enables script suffix routing such as `index.php/devices/42/` even if the Web Service FastCGI **PATH_INFO** toggle is off. `AcceptPathInfo Off` disables it, even if that toggle is on; `Default` restores the Web Service toggle. These settings apply to eligible FastCGI script files, not arbitrary static files. RustProxy preserves the rewritten suffix, including the trailing `/`, in the FastCGI `PATH_INFO`; `SCRIPT_FILENAME` still refers only to the existing executable file under the document root. PHP-FPM must be enabled with the correct socket and `.php` extension. If an `.htaccess` rule rewrites to `.php` but that handler is missing, Web Service validation now produces an explicit warning rather than silently accepting a non-functional front controller. The stock Web Service index list additionally tries `index.php` *last* when PHP-FPM for `.php` is enabled, while explicit index lists are unchanged. An `.htaccess` edit requires re-applying the service.
`ErrorDocument 404 /error.php?404` and other **local** `ErrorDocument` targets (HTTP 400–599) are supported for GET/HEAD. RustProxy performs one internal Web Service request for the error document and preserves the original error status when the document succeeds. The same filesystem and security controls apply to that document; recursive error handling is prohibited. External URL targets and custom literal error messages are not supported. Errors from other methods keep their built-in error response. `Options FollowSymlinks` and `Options MultiViews` are **not** equivalent to RustProxy's symlink policy and Apache content negotiation: they are still warned/skipped with Strict off. `Options -MultiViews` is accepted because MultiViews is not enabled. Do not assume these options are active.
**Example of a front controller with `PATH_INFO`:**
```apache
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1/ [L]
AcceptPathInfo On
ErrorDocument 404 /error.php?404
```
For application-specific route exclusions, remember that `%{REQUEST_URI}` begins with `/`; use `!^/api/` rather than `!^api/` when excluding `/api/` URLs. A rule containing `RewriteCond %{REQUEST_URI} !\.php` prevents repeatedly rewriting `/index.php/...` on subsequent passes. See [FastCGI](FASTCGI.md).
For common Apache 2.2 migrations, `Order deny,allow`, `Order allow,deny`, `Order mutual-failure`, `Allow from all` / `Deny from all`, and `Allow from` / `Deny from` explicit IP addresses or CIDR networks (IPv4/IPv6) are supported and **enforced** using the actual client IP. For instance, `Deny from all` blocks the affected directory, returning HTTP 403; it is not silently ignored. `Order allow,deny` denies unmatched clients by default, while `Order deny,allow` allows them by default. Hostname-based ACLs and other unsupported access/authentication constructs fail validation even with Strict disabled. Test allow/deny cases after migrating; legacy access rules are not a general Apache authorization emulator.