Describe the bug
The request handling of a custom action created with the linkToRoute method does not work as expected if the app is behind a reverse proxy.
Symfony handles well the reverse proxy settings: it will detect the URI prefix (/my-app) and will not consider it during routing process.
To Reproduce
In standard CRUD Controller, create custom action and use linkToRoute() to specify the target based on an existing route.
Go on your app and click on the link.
Here, src/EventListener/AdminRouterSubscriber.php will detect the route name from the query string and will generate the url. If behind a reverse proxy, the url will contain the uri prefix /my-app.
As you can see in the screenshot below, the REQUEST_URI will be set with this url, but it should not include the uri prefix
(OPTIONAL) Additional context
Possible solutions
1.
Instead of generate the url to detect the controller to call, we could rely on routes configuration:
Describe the bug The request handling of a custom action created with the linkToRoute method does not work as expected if the app is behind a reverse proxy.
Context
To Reproduce
(OPTIONAL) Additional context
Possible solutions 1. Instead of generate the url to detect the controller to call, we could rely on routes configuration:
2. Why don't we just forward the request to the route name ? Like
AbstractController::forward() method
?3. Instead of creating the link like
/admin?routeName=app_my_route
, generate the right url:/my-route