我试图在网站上搜索我的问题,但没有运气。
我已经创建了一个jspweb应用程序并部署在googleappengine上。它不使用google帐户身份验证,而是使用parse.com作为后端数据存储。”jsp”是它的欢迎文件。当我在gae上点击url,比如在firefox上的“http://{project name}.appspot.com”,它显示:
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.
我去了firebug,发现“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已找到”响应“was”重新加载页面以获取源代码:http://{project\u id}.appspot.com/login.jsp
奇怪的是,这个web应用在本地开发环境下运行良好,但在gea上部署时却失败了。
2条答案
按热度按时间njthzxwz1#
在gae上可以执行的重定向的峰值数为25。这是为了防止无限循环。
因此,如果你得到这个错误,确保你没有陷入无限循环。
3pmvbmvn2#
我在网络应用程序中有一个sessionfilter。由于gae不支持sessionfilter,在我删除这个过滤器之后,这个web应用在gea上运行得很好。