The HTTP Cache, when turned on, uses the following URL for internal hash lookup request: /_fos_user_context_hash. In a case when the main request has the siteaccess that was matched using the Map/URI Matcher, first few characters (as many as the Matcher key has, e.g. "pol" => 3 characters) are removed from the beginning of the internal request URL, resulting in invalid URL (e.g. "s_user_context_hash"). This shorter, invalid URL is not matched against any route for obvious reasons and is returning a 404 response.
Steps to reproduce
- Create new eZ Platform installation.
- Log in to the PlatformUI. Go to "Admin panel"/"Languages". Create new language there (e.g. "pol-PL").
- In the PlatformUI, go to "Content"/"Content structure". There, translate the "eZ Platform" folder to the other language.
- In the file app/config/ezplatform.yml, change the siteaccess configuration to this (example for "pol_PL" language):
- In the file app/config/config_prod.yml, change the action_level key from critical to error.
- In the PlatformUI, go to "Admin panel"/"Roles"/"Anonymous". Edit user/login/siteaccess Limitation there and add the second siteaccess to it.
- Clean your cookies (or use incognito mode) and go to "your-site.prod/pol" URL (example for configuration above). Make sure to use the production environment for this request. After accessing it, you will see the following in your production logs:
Side note: it is possible that other Siteaccess Matchers are also causing this behaviour, but in another manner. The solution should ideally solve the problem for all of them.