I've just setup varnish and i've done some tests on port 8080 before switching in production.
I've noticed that if i'm on a cached page :
/**
* @Cache(smaxage="10800")
* @Route("/{_locale}/", name="homepage2", requirements={"_locale" = "en|fr"})
* @Template()
*/
public function indexAction()
{
return array();
}
And I try to login (not using external services, but with normal login) via the component included via an ESI
{% render "GamerCertifiedHomeBundle:Home:login" with {}, { 'standalone': true } %}
It ends up redirecting me on a page with no style and no head with the url ...:8080/_internal/secure/MyBundleHomeBundle:Home:login/none.html
Step1 Screenshot / Step2 Screenshot
If I go back on the homepage, i'm logged in.
How can I avoid that please ?
EDIT :
After analyzing the problem in the chat I found that _target_path
for security successful redirect is generated in form in the next way:
<input type="hidden" name="_target_path" value="{{ app.request.uri }}" />
And since this part is rendered with standalone view - it has specific uri (with _internal
prefix).
You can avoid this by applying changed logic for your app.request.uri
injection.
Pass it to controller:
{% render yourAction with {'uri': app.request.uri}, {'standalone': true} %}
In your controller just pass it to your view
public function yourAction ($uri)
{
...
return array('uri' => $uri);
}
Use it in your template
<input type="hidden" name="_target_path" value="{{ uri }}" />
Enjoiy! ;)