title: Redirect loop on my web app on Google App Engine
body: <p>I have tried to search around the site for my problem but with no luck.</p>
  
  <p>I have created a JSP web app and deployed on Google App Engine. It does not use Google Account authentication but Parse.com as back end data storage. "login.jsp" is its welcome file. When I hit the URL on GAE like "http://{project-name}.appspot.com" on Firefox, it show:</p>
  
  <pre><code>The page isn't redirecting properly
  
  Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
  
  This problem can sometimes be caused by disabling or refusing to accept cookies.
  </code></pre>
  
  <p>I went to Firebug and found that "GET login.jsp" was called more than 20 times automatically.</p>
  
  <p>While I tried it with Chrome, it returned a different but similar message:</p>
  
  <pre><code>This webpage has a redirect loop
  
  The webpage at http://{project-name}.appspot.com/login.jsp has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
  Learn more about this problem.
  Error code: ERR_TOO_MANY_REDIRECTS
  </code></pre>
  
  <p>Any idea?</p>
  
  <p>EDIT --- code for the login.jsp is as below</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Log in&lt;/title&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  
      &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.css" /&gt;
      &lt;style&gt;
      .alert-info {
          font-weight: bold;
          margin-bottom: 4px;
          padding: 8px 14px;
      }
  
      .full-layout { padding:2%; }
      &lt;/style&gt;
      &lt;script src="http://code.jquery.com/jquery-2.1.1.min.js"&gt;&lt;/script&gt;
      &lt;script src="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          $.mobile.ajaxEnabled = false;
      &lt;/script&gt;
  &lt;/head&gt;
  
    &lt;body&gt;
    &lt;div class="full-layout"&gt;
      &lt;h1&gt;Log in&lt;/h1&gt;
      &lt;% String alertMsg = (String) request.getSession().getAttribute("loginResultMsg");
          if (alertMsg != null) {
      %&gt;
          &lt;%= alertMsg %&gt;     
      &lt;% } %&gt;
      &lt;form action="LoginServlet" method="post"&gt;
          Name:&lt;input type="text" name="name"&gt;&lt;br&gt;
          Password:&lt;input type="password" name="password"&gt;&lt;br&gt;
          &lt;input type="submit" value="Log in"&gt;
      &lt;/form&gt;
      &lt;%  request.getSession().setAttribute("loginResultMsg", null); %&gt;
  &lt;/div&gt;
  &lt;%@include file="footer.jsp" %&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Firebug's Network console logged:</p>
  
  <pre><code>GET login.jsp
  </code></pre>
  
  <p>and the status was "302 Found". "Response" was "Reload the page to get source for: http://{PROJECT_ID}.appspot.com/login.jsp"</p>
  
  <p>The weird thing is the web app works well on local development environment but fails while deployed on GEA.</p>