我試圖在網站上搜索我的問題,但沒有運氣。在Google App Engine上的我的網絡應用上重定向循環
我創建了一個JSP Web應用程序並部署在Google App Engine上。它不使用Google帳戶身份驗證,而是使用Parse.com作爲後端數據存儲。 「login.jsp」是它的歡迎文件。在Firefox上:「// {項目名稱} .appspot.com的HTTP」,它顯示:當我打的網址上GAE像
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.
我去螢火蟲,發現「GET login.jsp的」是自動調用超過20次。
雖然我與Chrome嘗試它,它返回一個不同但類似的消息:
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
任何想法?
EDIT ---爲login.jsp的代碼如下
<%@ 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的網絡控制檯登錄:
GET login.jsp
和狀態是 「302找到」。 「響應」是「重新加載頁面以獲取源代碼:http:// {PROJECT_ID} .appspot.com/login.jsp」
奇怪的是,Web應用程序在本地開發環境中運行良好,但部署失敗在GEA上。
你可以發佈你的login.jsp嗎?基本上login.jsp發送一個重定向到它自己。這可能是因爲login.jsp中的代碼或應用中的其他過濾器或servlet。 – nhylated
你能看到你從初始的'GET login.jsp'得到的響應,以查看它重定向到的確切url嗎?這可能會幫助你調試你的代碼。 – tx802
我會給@nhylated一個大拇指。謝謝 – alextc