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

fileserver: Add first_exist_fallback strategy for try_files #6699

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dunglas
Copy link
Collaborator

@dunglas dunglas commented Nov 18, 2024

When using modern frameworks such as Symfony and Laravel, by convention, all requests are handled by a front controller named index.php in the document root.

Currently, Caddy does a call to fs.Stat() at each request to check that this file exists, but in case we use such a framework, this call is useless because we know that the file exists.

This PR adds a new first_exist_fallback policy that assumes that the last file in the list always exists.

@mohammed90
Copy link
Member

mohammed90 commented Nov 18, 2024

I don't understand why go get fails now 😑

Edit: Nevermind. It's failing because we're not handling forks properly in that job.

@francislavoie francislavoie added the optimization 📉 Performance or cost improvements label Nov 19, 2024
@francislavoie francislavoie added this to the v2.9.0-beta.4 milestone Nov 19, 2024
@dunglas dunglas changed the title feat: add first_exist_or_fallback strategy for try_files feat: add first_exist_fallback strategy for try_files Nov 19, 2024
@dunglas dunglas marked this pull request as ready for review November 21, 2024 22:10
@francislavoie francislavoie changed the title feat: add first_exist_fallback strategy for try_files fileserver: Add first_exist_fallback strategy for try_files Nov 22, 2024
Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization 📉 Performance or cost improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants