I'm running into really strange behaviour from EasyAdmin (version 1.11.7 and 1.11.8 tested).
I have setup the routing as follows:
easy_admin_bundle:
resource: "@EasyAdminBundle/Controller/"
type: annotation
prefix: /admin
After clicking around some list pages from some entities and finally reloading a list page all is fine. When afterwards I open https://
Only when doing a hard refresh it is all normal again.
As you can see in the attached images it somehow loads the css from cache from whatever url.


Wow! That's what I call a hard-to-debug error :confused:
In case you haven't looked at how we render the CSS, I'll explain briefly:
easyadmin.css.twig template to generate a dynamic CSS file./admin/_css/easyadmin.csslayout.html.twig template: <link rel="stylesheet" href="{{ path('_easyadmin_render_css') }}">Looking at your error:
It looks like some cache is doing nasty things ... but I'm completely clueless about this error.
@dopee a friendly ping to ask you if you could get more information about the conditions that trigger this error or if you managed to solve it? Thanks!
I have exactly the same problem. I'll try to send all stack trace from debug before redirection.
In case it's useful, the latest 1.12.1 version of this bundle has just been released. If confirmed, I consider this bug critical, so I hope you can find some time to test that version or to provide more information to reproduce the issue. Thanks!
I don't have much time to test, but I'll try to update and check if the problem still persists.
Will get back to you.
I've run composer update and it installed version 1.12.2
I'm sorry to report that the problem still persists.
I do not have anything else to mention than stated in the first post.
In short the following will trigger it for certain in my case:
@dopee thanks for taking a look at this! Let's see if @davidpv can also provide us more information to reproduce this issue. Thanks!
I also had a problem with easyadmin.css. I don't think it was the same one, but maybe it can give some ideas about what could be happening.
The problem: I've created a login page which included the easyadmin.css. After a successful login, I was being redirected to /admin/_css/easyadmin.css instead of the page I tried to access before the login.
The solution: My access control rules were set to block anonymous access to everything under /admin (except to /admin/login). Since the easyadmin.css is also under /admin and it is a route in the application, it was getting blocked. So, when I tried to access a protected area, the following happened:
/admin/admin is protected, redirect to /admin/login and store /admin as the target_path/admin/_css/easyadmin.css, which redirected to /admin and stored /admin/_css/easyadmin.css as the target_url (I didn't notice any styling problem caused by this redirect because I wasn't using any of the styles of the css file. I was just including it)I don't think this is a bug with EasyAdmin. Just a special case that one have to keep in mind. Maybe it would be helpful to add a note about it to the documentation.
I've created my own workaround by extending the AdminController and altering app/config/router.yml
It seems ok now. Basically I disabled all clientside caching on easyadmin.css.
Is it possible to check test this and incorporate in the bundle?
`namespace AppBundle\Controller;
use JavierEguiluz\Bundle\EasyAdminBundle\Controller\AdminController as EasyAdminController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class AdminController extends EasyAdminController
{
/**
* It renders the main CSS applied to the backend design. This controller
* allows to generate dynamic CSS files that use variables without the need
* to set up a CSS preprocessing toolchain.
*
* @Route("/_css/easyadmin.css", name="_easyadmin_render_css")
*
* @return Response
*/
public function renderCssAction()
{
$config = $this->container->getParameter('easyadmin.config');
$cssContent = $this->renderView('@EasyAdmin/css/easyadmin.css.twig', array(
'brand_color' => $config['design']['brand_color'],
'color_scheme' => $config['design']['color_scheme'],
));
$response = Response::create($cssContent, 200, array('Content-Type' => 'text/css'))
->setPrivate()
->setSharedMaxAge(0)
->setMaxAge(0)
;
$response->headers->addCacheControlDirective('must-revalidate', true);
return $response;
}
}
`
router.yml
easy_admin_bundle:
resource: "@AppBundle/Controller/AdminController.php"
type: annotation
prefix: /admin
An update about this: we're going to remove this route associated with this CSS. The CSS contents will be preprocessed during container compilation. This hopefully will solve all problems.
The new version of the bundle, 1.12.5, has just been published. The URL associated with the CSS file no longer exists, so this error should be fixed.
Most helpful comment
An update about this: we're going to remove this route associated with this CSS. The CSS contents will be preprocessed during container compilation. This hopefully will solve all problems.