Change creation of HopSession cookie value
Only include one of either, IP forwarded by proxy or remote address
This commit is contained in:
parent
4fc158d6eb
commit
411b9198e4
1 changed files with 7 additions and 2 deletions
|
@ -554,8 +554,13 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
// If protected session cookies are enabled we also force a new session
|
// If protected session cookies are enabled we also force a new session
|
||||||
// if the existing session id doesn't match the client's ip address
|
// if the existing session id doesn't match the client's ip address
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
addIPAddress(buffer, request.getRemoteAddr());
|
String ip = request.getHeader("X-Forwarded-For");
|
||||||
addIPAddress(buffer, request.getHeader("X-Forwarded-For"));
|
if (ip != null && ip.length() != 0) {
|
||||||
|
addIPAddress(buffer, ip);
|
||||||
|
} else {
|
||||||
|
addIPAddress(buffer, request.getRemoteAddr());
|
||||||
|
}
|
||||||
|
// Not sure, if this line can be removed
|
||||||
addIPAddress(buffer, request.getHeader("Client-ip"));
|
addIPAddress(buffer, request.getHeader("Client-ip"));
|
||||||
if (reqtrans.getSession() == null || !reqtrans.getSession().startsWith(buffer.toString())) {
|
if (reqtrans.getSession() == null || !reqtrans.getSession().startsWith(buffer.toString())) {
|
||||||
createSession(response, buffer.toString(), reqtrans, domain);
|
createSession(response, buffer.toString(), reqtrans, domain);
|
||||||
|
|
Loading…
Add table
Reference in a new issue