问题描述:
在一次浏览网站后台日志中发现报错,org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL was not normalized.
报错日志:
2023-10-10 13:08:14.068 logback [http-nio-9999-exec-9] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL was not normalized.
问题分析:
这个错误是由Spring框架中的Spring Security组件抛出的RequestRejectedException异常。异常的原因是请求的URL没有进行规范化处理。
在Web开发中,URL规范化是指对URL进行标准化处理,确保URL符合规范和标准。通常情况下,URL需要符合RFC 3986规范,包括去除多余斜杠、处理URL编码、处理特殊字符等。
当Spring Security检测到请求的URL没有进行规范化处理时,会抛出RequestRejectedException异常,拒绝该请求的执行。
解决办法:
要解决