EasyCorp / EasyAdminBundle

EasyAdmin is a fast, beautiful and modern admin generator for Symfony applications.
MIT License
3.99k stars 1.01k forks source link

[4.9.1] Action::linkToRoute does not handle reverse proxy context #6244

Open kira0269 opened 1 month ago

kira0269 commented 1 month ago

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 image

Possible solutions 1. Instead of generate the url to detect the controller to call, we could rely on routes configuration:

$routes = $this->get('router')->getRouteCollection();
$controller = $routes->get($routename)->getDefaults()['_controller'];

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

kira0269 commented 1 month ago

Workaround:

Instead of using linkToRoute('app_my_route'), I use linkToUrl($this->generateUrl('app_my_route'))