How to go back to referer after login failure?
I solved it. There is solution: How to disable redirection after login_check in Symfony 2 and here is code which solves my problem: <?php namespace Acme\MainBundle\Handler; use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RedirectResponse; class AuthenticationHandler implements AuthenticationFailureHandlerInterface, LogoutSuccessHandlerInterface { public function onAuthenticationFailure(Request $request, AuthenticationException $exception) { $referer = $request->headers->get(‘referer’); $request->getSession()->setFlash(‘error’, $exception->getMessage()); return … Read more