2

I am facing an weird issue,sometimes when an user weather he is active or not reloads the page or click on any other page,the session logs out. I am using FOS User Bundle here.Also,in that case the webpage loads the half of the expected page and half of the login page. This leads to a broken design. So I have 2 problems here:

  1. Unexpected session timeout.
  2. Loading of two twig files at the same time. I assume symfony security tries to loads the login page once it finds the session is timed out,at the same time where the current file was loading.

This is how my config.yml file session section looks like.

framework: #esi: ~ #translator: { fallback: "%locale%" } secret: "%secret%" router: resource: "%kernel.root_dir%/config/routing.yml" strict_requirements: ~ form: ~ csrf_protection: ~ validation: { enable_annotations: true } templating: engines: ['twig'] #assets_version: SomeVersionScheme default_locale: "%locale%" trusted_hosts: ~ trusted_proxies: ~ session: # handler_id set to null will use default session handler from php.ini # handler_id: ~ handler_id: session.handler.native_file save_path: "%kernel.root_dir%/sessions" # to avoid this error- Symfony2 and ContextErrorException: Warning: SessionHandler::read() Exception fragments: { path: /_fragment } http_method_override: true 
1
  • It almost sound like your logout functionality is being prefetched by the browser (like the browser does other GETs). You should put your logout functionality in a POST to avoid it. See, for example, Which HTTP method should Login and Logout Actions. Commented Feb 4, 2015 at 20:45

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.