Skip to content

fix: match workers when resolve_root_symlink is false - #2739

Open
dunglas wants to merge 3 commits into
mainfrom
fix/worker-unresolved-symlink-path
Open

dunglas wants to merge 3 commits into
mainfrom
fix/worker-unresolved-symlink-path

Conversation

@dunglas

@dunglas dunglas commented Oct 21, 2026

Copy link
Copy Markdown
Member

Fixes #2736.

Since 1.13.0, a php_server worker is never selected when resolve_root_symlink false is set and the root is a symlink: requests run on a regular thread and the script fails with "FrankenPHP must be in worker mode".

resolveWorkerFile() always resolves symlinks in the worker filename, and workers are indexed under that path. With resolve_root_symlink false, the document root keeps its symlinked path, so SCRIPT_FILENAME is the declared path and the workersByPath lookup misses. Before #2499, the Caddy module matched workers against the unresolved path itself and passed the worker by name, which hid the mismatch.

Workers are now also indexed under their declared absolute path, in both Server.workersByPath and globalWorkersByPath. The extra key cannot collide with another worker: a declared path that differs from its resolved form contains a symlink, and resolved paths never do.

The new PhpServerWorkerWithoutResolveRootSymlink test reproduces the reporter's setup and fails without the fix.

dunglas and others added 3 commits October 21, 2026 16:33
Worker filenames are always resolved through symlinks, but a document
root whose symlinks are kept builds SCRIPT_FILENAME from the declared
path, so the lookup missed and the request ran outside worker mode.
Also index each worker under its declared absolute path.

Fixes #2736

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worker mode no longer working in v1.13.1

2 participants