Set cookie path to context path without trailing slash
Closes gh-1863
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -432,7 +432,8 @@ public class DefaultCookieSerializer implements CookieSerializer {
|
||||
|
||||
private String getCookiePath(HttpServletRequest request) {
|
||||
if (this.cookiePath == null) {
|
||||
return request.getContextPath() + "/";
|
||||
String contextPath = request.getContextPath();
|
||||
return (contextPath != null && contextPath.length() > 0) ? contextPath : "/";
|
||||
}
|
||||
return this.cookiePath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user