[英]Symfony easyadmin ERR_TOO_MANY_REDIRECTS on production server
I implemented the admin panel using a EasyAdminBundle 3.0 version.我使用 EasyAdminBundle 3.0 版本实现了管理面板。
I have the following controller with routing annotation:我有以下带有路由注释的 controller :
/**
* @Route("/admin/dashboard", name="admin")
*/
public function index():Response
{
$routeBuilder = $this->get(AdminUrlGenerator::class);
return $this->redirect($routeBuilder->setController(UserCrudController:>
}
Another route is working fine, only easyadmin routes are not working.另一条路线工作正常,只有 easyadmin 路线不起作用。 This works fine on my development server.这在我的开发服务器上运行良好。 However, on my production server, I get an infinite redirect route.但是,在我的生产服务器上,我得到了一个无限的重定向路由。 I looked through the logs and it is caused by Symfony, not Apache.我查看了日志,它是由 Symfony 引起的,而不是 Apache 引起的。 It does this over and over until my browser stops它一遍又一遍地这样做,直到我的浏览器停止
I had the same issue when i put in prod and finally it was solved by adding a slash to the route name我在输入 prod 时遇到了同样的问题,最后通过在路由名称中添加斜杠解决了这个问题
/**
* @Route("/admin/dashboard", name="admin/")
*/
public function index():Response
{
$routeBuilder = $this->get(AdminUrlGenerator::class);
return $this->redirect($routeBuilder->setController(UserCrudController:>
}
I made a mistake in the last post.我在上一个帖子中犯了一个错误。 It was like this in my controller.我的 controller 就是这样。 Not the name but the path.不是名字而是路径。 My bad, sorry.我的错,对不起。
/**
* @IsGranted("ROLE_ADMIN")
* @Route("/admin/", name="admin")
*/
public function index():Response
{
$routeBuilder = $this->get(AdminUrlGenerator::class);
return $this->redirect($routeBuilder->setController(UserCrudController:>
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.