The isssue I am trying to address is to automatically redirect my application to the user entered url after login. Since I have a centralized authentication server I cant user 'HTTP_REFERER' as it always returns null when am being transferred to the authentication server.
My solution is to use the security.yml
in my application server to pass the redirection url as url parameter. I have implemented that as follows,
parameters.php
$container->setParameter('referer', $_SERVER['REQUEST_URI']);
security.yml
secured_area:
pattern: ^/
stateless: true
form_login:
login_path: %accounts_host%/signin?referer=%referer%
simple_preauth:
authenticator: app.security.authenticator
But my issue is that the referer
parameter in security.yml
is always static. It always gives the first application url I type in. Lets say if i type www.appserver.com/product/1
, the next time if I type in www.appserver.com/product/200
the referer
will always return www.appserver.com/product/1
in the authenitcation server.
However, If I do a print_r($_SERVER['REQUEST_URI']); exit();
in the parameters.php
the value changes for my each request.
I was at this for quite some time and I am very lost at this point. Any help on getting this referer
value dynamically on the security.yml
would be really appreciated. thanks :)