Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Closed
Description
Symfony version(s) affected
6.4.10
Description
The host locale feature in Symfony is intended to set the locale based on the request's host. However, this feature does not work for static routes defined in routing configuration files. While the host locale is correctly applied when using annotation routes, static routes do not respect this configuration, resulting in the inability to serve localized static content like robots.txt based on the domain or subdomain.
How to reproduce
Expected config (it not works)
robots_txt:path:/robots.txthost:en:example.ukde:example.dedefaults:_controller:Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction_format:txttemplate:static/robots.txt.twig
Workaround (it works)
robots_txt.en:path:/robots.txthost:example.ukdefaults:_locale:en_controller:Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction_format:txt_canonical_route:robots_txttemplate:static/robots.txt.twigrobots_txt.de:path:/robots.txthost:example.dedefaults:_locale:de_controller:Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction_format:txt_canonical_route:robots_txttemplate:static/robots.txt.twig
Possible Solution
No response
Additional Context
No response