title: Why does Symfony2 replace PHPSESSID upon login?
body: <p>My Symfony2 application replaces my <code>PHPSESSID</code> cookie when it logs me in. Is this expected behavior? It makes no sense to me... why not just keep the same <code>PHPSESSID</code>?</p>
  
  <p>Here's a little more detail.</p>
  
  <p>To log in to my application, I <em>must</em> first make a request to a URL that hits my app:</p>
  
  <pre><code>$ telnet myapp 80
  GET / HTTP/1.1
  Host: myapp
  </code></pre>
  
  <p>I'm redirected to another URL (<code>/login</code>) and given a <code>PHPSESSID</code> cookie. Fine. Then I <code>POST</code> to <code>/login_check</code> something like <code>_username=blah&amp;_password=blah</code>, and whether or not I provide proper credentials, I'm sent a different <code>PHPSESSID</code> cookie.</p>
  
  <p>Seems like most anything works for this first request, but I must make <em>some</em> request (I can't just <code>POST</code> to <code>/login_check</code> and be logged in). Is this expected behavior?</p>
  
  <p>Not sure if it matters, but I'm using FOSUserBundle.</p>
  
  <p>I guess I should mention that none of this matters until I put my application on two webservers behind a load balancer, and tell the load balancer to use stickiness based on <code>PHPSESSID</code>. As you might imagine, the <code>PHPSESSID</code> replacement behavior prevents login from working if a client happens to bounce to the other webserver.</p>
  
  <p>Possible duplicate: <a href="https://stackoverflow.com/questions/10121769/symfony2-login-does-not-work-on-first-try-after-clearing-cookies">Symfony2: login does not work on first try after clearing cookies</a></p>