Redirect for anonymus user doesn´t work from Controller Community,
i´ve got a simple COntroller for redirect my users by visiting a special path (localhost/drupal8/check). At the moment the redirect works for the administrator and for registrated user, if they are logged in, but not for the quests of my site (i know that it is only a local site).

namespace Drupal\testmodule\Controller; 
use Drupal\Core\Controller\ControllerBase;

class EntityChecker extends ControllerBase {

  public function redirectToFront($bundle, $label) { return $this-&gt;redirect('&lt;front&gt;');

}
}


In the log i´m getting the following error:


  [30-Jul-2018 09:30:25 UTC] RuntimeException: Failed to start the
  session because headers have already been sent by
  "C:\wamp64\www\drupal8\vendor\symfony\http-foundation\Response.php" at
  line 1274. in
  C:\wamp64\www\drupal8\vendor\symfony\http-foundation\Session\Storage\NativeSessionStorage.php
  on line 141 #0
  C:\wamp64\www\drupal8\core\lib\Drupal\Core\Session\SessionManager.php(164):
  Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()


Thanks a lot for helping me
Try this

&lt;?php

namespace Drupal\testmodule\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\RedirectResponse;

class EntityChecker extends ControllerBase {

  public function redirectToFront($bundle, $label) {
    $response = new RedirectResponse("/");
    $response-&gt;send();
  }

}