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

apache2.xml Add notes about FallbackResource #4580

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andrewnicols
Copy link
Contributor

@andrewnicols andrewnicols commented Apr 3, 2025

I recently encountered an issue when configuring a FallbackResource for Apache.

We are in the process of migrating legacy paths to use a routing engine and as part of the migration we are providing a shim. As a result we have users hitting paths such as /example.php which are now expected to be handled by the Routing system.

We discovered that our Apache2 test images were not hitting the Routing system for these paths and, after digging, that it's because the SetHandler and AddHandler directives are set based on the path location rather than the file. That is, if the location https://example.com/example.php is requested then the <FilesMatch> directive is always applied based on the \.php$ regex match. As a result, the FallbackResource directive is not applied (beceause a Handler has already been applied).

This has previously been rejected as a bug in Apache2 as it is the expected behaviour.

I have:

Given that the FallbackResource is the recommended way to use a routing system such as Symfony it is probably worth documenting:

  • the use of the FallbackResource directive; and
  • the need to use an If -f directive when setting the handler to only apply it when the requested file actually exists.

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.

1 participant