title: Why do I get an invalid-session redirect after a Spring Security logout?
body: <p>I have a Spring MVC project which uses Spring Security. I am wondering how <code>j_spring_security_logout</code> works. I have a logout link defined in a view like this:</p>
  
  <pre><code>&lt;a href="&lt;c:url value="/j_spring_security_logout" /&gt;"&gt;Logout&lt;/a&gt; 
  </code></pre>
  
  <p>In my <code>spring-security.xml</code> I have defined this:</p>
  
  <pre><code>&lt;form-login login-page="/login" default-target-url="/wellcome" authentication-failure-url="/loginfailed"  /&gt;
  &lt;logout logout-success-url="/logout" logout-url="/j_spring_security_logout" /&gt;
  &lt;session-management invalid-session-url="/invalidsession" /&gt;
  </code></pre>
  
  <p>I expected that clicking logout should redirect me to <code>/logout</code>, but instead I get redirected to the <code>invalid-session-url</code>, namely <code>/invalidsession</code>. The <code>logout-success-url</code> is ignored.</p>
  
  <p>However when I delete <code>session-management</code>, logging out does indeed redirect me to <code>/logout</code>.</p>