[英]spring security : logout does not work when having long relative path
在我的Spring Security应用程序中,我的注销按钮带有以下代码
<li><a href="<c:url value="j_spring_security_logout"/>">Log out</a></li>
现在,当我的URL为http://localhost:8080/servletname
,注销正常。
即使它是http://localhost:8080/servletname/abc
它也可以正常工作。
但是,当URL为http://localhost:8080/servletname/abc/xyz
时,单击注销按钮时,我得到一个404页面,因为该页面被重定向到http://localhost:8080/servletname/abc/j_spring_security_logout
。
我该如何解决?
“>退出查看链接,尤其是一部分:
Given a base URL and a relative URL (that does not begin with a slash), a full URL is derived as follows:
If the base URL ends with a slash the full URL is derived by appending the relative URL to the base URL. For example, if the base URL is http://nosite.com/dir1/dir2/ and the relative URL is gee.html, the derived URL is http://nosite.com/dir1/dir2/gee.html.
If the base URL doesn't end with a slash, the last piece of the base URL is considered a resource, so the full URL is derived by appending the relative URL to the parent of the base URL. For example, if the base URL is http://nosite.com/dir1/dir2 and the relative URL is gee.html, the derived URL is http://nosite.com/dir1/gee.html
您正在使用相对路径,请在网址开头使用“ /”将其设为绝对路径:
<a href="<c:url value="/j_spring_security_logout"/>">Log out</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.