0
votes

I have tried to search around the site for my problem but with no luck.

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:

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.

I went to Firebug and found that "GET login.jsp" was called more than 20 times automatically.

While I tried it with Chrome, it returned a different but similar message:

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

Any idea?

EDIT --- code for the login.jsp is as below

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
    <title>Log in</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.css" />
    <style>
    .alert-info {
        font-weight: bold;
        margin-bottom: 4px;
        padding: 8px 14px;
    }

    .full-layout { padding:2%; }
    </style>
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.js"></script>
    <script type="text/javascript">
        $.mobile.ajaxEnabled = false;
    </script>
</head>

  <body>
  <div class="full-layout">
    <h1>Log in</h1>
    <% String alertMsg = (String) request.getSession().getAttribute("loginResultMsg");
        if (alertMsg != null) {
    %>
        <%= alertMsg %>     
    <% } %>
    <form action="LoginServlet" method="post">
        Name:<input type="text" name="name"><br>
        Password:<input type="password" name="password"><br>
        <input type="submit" value="Log in">
    </form>
    <%  request.getSession().setAttribute("loginResultMsg", null); %>
</div>
<%@include file="footer.jsp" %>
</body>
</html>

Firebug's Network console logged:

GET login.jsp

and the status was "302 Found". "Response" was "Reload the page to get source for: http://{PROJECT_ID}.appspot.com/login.jsp"

The weird thing is the web app works well on local development environment but fails while deployed on GEA.

2
Can you post your login.jsp? Basically login.jsp is sending a redirect to itself. This could be because of code in your login.jsp or some other filter or servlet in your app. - nhylated
Can you see the response you're getting from the initial GET login.jsp to see the exact url it's redirecting to? That might help you debug your code. - tx802
I would give a thumb-up to @nhylated. Thanks - alextc

2 Answers

0
votes

There is a peak number of redirects that can be performed on GAE namely 25. This is to prevent infinite loops.

Therefore, if you are getting this error, make sure that you are not stuck in an ad-infinitum loop.

0
votes

I had a SessionFilter in the web app. As SessionFilter is not supported by GAE, after I remove this filter the web app worked well on GEA.