v0.42.2_fix2
This commit is contained in:
1 parent
15c7f9ff9e
commit
25148f26eb
14 files changed
+407
-54
No files matched your search
@@ -108,3 +108,7 @@ curl -Ik https://portal.example.test/console/cgi-bin/config.txt
|
||||
- **Browser downloads a script:** verify the active Web Service and extension. RustProxy refuses to send known executable script extensions as static files when no matching handler is configured.
|
||||
|
||||
The new protocol paths are covered by source-level tests using a mock FastCGI responder. Before production use, run `./dev.sh check` and `./dev.sh test` with the project toolchain and exercise real PHP-FPM and fcgiwrap instances; mock responders cannot prove OS-level script execution.
|
||||
|
||||
### `.htaccess` front-controller suffixes
|
||||
|
||||
When `.htaccess` compatibility is enabled, `AcceptPathInfo On` allows an eligible FastCGI script to receive a rewritten `script.php/extra/` URL even if **PATH_INFO** is disabled at Web Service level. `AcceptPathInfo Off` overrides the Web Service toggle and denies suffix routing; `AcceptPathInfo Default` restores the Web Service setting. `SCRIPT_FILENAME` is always the existing script file under the Web Service document root. `PATH_INFO` is the path after that script, including the trailing slash, and `REQUEST_URI` remains the original requested URL. The FastCGI endpoint is still configured in the Web Service; `.htaccess` cannot select a socket. Explicit index lists remain unchanged; the default static index list also tries `index.php` last on PHP-FPM services handling `.php`. Re-apply the Web Service when the `.htaccess` file changes.
|
||||
+1
-1
@@ -32,7 +32,7 @@ RustProxy is a single service that combines a reverse proxy, a static/PHP web se
|
||||
|
||||
- Static sites and downloads served from reusable **Web Services** shared by several Vhosts.
|
||||
- Index files, optional directory listing, MIME mapping and attachment extensions.
|
||||
- `try_files`, regex rewrites and a safe subset of Apache `.htaccess` rules, including status-only `RedirectMatch 404` / `410` rules without `Location`.
|
||||
- `try_files`, regex rewrites and a safe subset of Apache `.htaccess` rules, including status-only `RedirectMatch 404` / `410`, active `RewriteBase`, PHP script `AcceptPathInfo` overrides and local `ErrorDocument` responses (GET/HEAD).
|
||||
- Conditional requests (`ETag`, `Last-Modified`), byte ranges, precompressed `.br`/`.gz` sidecars and optional Linux `sendfile`.
|
||||
- Symlink policy, attack-probe blocking and header hardening presets.
|
||||
- External FastCGI: PHP-FPM pools, CGI scripts via fcgiwrap, and generic FastCGI responders; Unix or loopback TCP endpoints, script allowlists, SCRIPT_NAME mount prefixes, PATH_INFO, bounded request/resource limits, Vhost location routing and shared profiles.
|
||||
|
||||
+21
-3
@@ -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.
|
||||
|
||||
|
||||
Reference in new issue
Block a user