Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastcgi: Implement resolve symlinks feature #3587

Merged
merged 1 commit into from
Jul 20, 2020

Conversation

endelwar
Copy link
Contributor

@endelwar endelwar commented Jul 18, 2020

This PR will enable resolving real path on symlinked releases.
When using a symlink based directory schema PHP, through Caddy, will serve old symlinked directory instead of resolving the actual real path of new released code: due to the nature of PHP opcache the new release path is not read by PHP because it’s cached and symlink path doesn’t change form PHP prospective.
Adding the new resolve_root_symlink subdirective on php_fastcgi will enable resolution of real path, thus permitting Caddy to server the actual codebase instead of the old one.

See this forum post to further details.

Example Caddyfile:

http://example.test {
    root * /var/www/deploy/current
    php_fastcgi 127.0.0.1:9000 {
        resolve_root_symlink
    }
}

Where /var/www/deploy/current is a symlink to real directory

@CLAassistant
Copy link

CLAassistant commented Jul 18, 2020

CLA assistant check
All committers have signed the CLA.

@francislavoie
Copy link
Member

Thanks!

I think resolve_symlinks would be a better name for the option, for consistency and brevity. We typically use underscores between words in option names.

@francislavoie francislavoie added the under review 🧐 Review is pending before merging label Jul 18, 2020
@francislavoie francislavoie added this to the v2.2.0 milestone Jul 18, 2020
@francislavoie francislavoie changed the title Add resolve symlink feature in php_fastcgi fastcgi: Implement resolve symlinks feature Jul 18, 2020
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is a pretty straightforward change.

modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go Outdated Show resolved Hide resolved
modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go Outdated Show resolved Hide resolved
@endelwar endelwar force-pushed the resolve-root-symlink branch from b31dc03 to 01a9b65 Compare July 19, 2020 14:46
@mholt mholt merged commit 2ae8c11 into caddyserver:master Jul 20, 2020
@mholt mholt removed the under review 🧐 Review is pending before merging label Jul 20, 2020
@endelwar endelwar deleted the resolve-root-symlink branch July 30, 2020 14:09
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.

4 participants