JSP会话ID在每次刷新时都会更改

问题描述:

我遇到的问题是JSP会话ID值在开发服务器上的每次浏览器刷新时都会发生变化,但我不知道是什么原因。

I am facing a problem that the JSP session ID value changes on every Browser refresh on the development server, but I do not know what is the reason.

My JSP sessiontest.jsp:

My JSP sessiontest.jsp:


<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here
</head>
<body>
<a href="sessiontest.jsp?id="><%=session.getId()%>  
</body>

我的浏览器是Firefox 5,服务器是Tomcat 6.

My browser is Firefox 5,and the server is Tomcat 6.

我测试了这个JSP上 http:// localhost:8080 / SessionTest / sessiontest.jsp?id = B68DA1C526F083800AED9D83AF1C8BC0 ,一切正常,刷新后会话ID保持不变。但是,如果我在开发服务器上部署war文件(http://www.company.com/subdomain/SessionTest/sessiontest.jsp),则每次刷新时会话ID值都会更改。
任何帮助将不胜感激。
谢谢。

I have tested this JSP on http://localhost:8080/SessionTest/sessiontest.jsp?id=B68DA1C526F083800AED9D83AF1C8BC0, everything is fine and session ID remains the same after refreshing. But if I deploy the war file on the development server, (http://www.company.com/subdomain/SessionTest/sessiontest.jsp), the session ID value changes on every refresh. Any helps would be greatly appreciated. Thanks.

我怀疑贵公司网站没有运行只有Tomcat服务器但有一个 Apache网络服务器面对它。这是公司网站的标准做法。

I suspect your company website is not running with only Tomcat server but has an Apache web server fronting it. This is standard practice for corporate web sites.

Apache Web服务器有一些设置和配置 mod_proxy for ProxyPassReverse 维护浏览器< - > Apache< - > Tomcat之间的会话。

The Apache web server has some settings and config for mod_proxy for ProxyPassReverse to maintain the session between browser <-> Apache <-> Tomcat.

你能查询一下吗?管理团队呢?

Can you check with your admin team on that?