关于系统
我的项目中有这种格式的URL: -
http://project_name/browse_by_exam/type/tutor_search/keyword/class/new_search/1/search_exam/0/search_subject/0
Run Code Online (Sandbox Code Playgroud)
其中关键字/类对意味着使用"class"关键字进行搜索.
我有一个常见的index.php文件,它为项目中的每个模块执行.只有一个重写规则可以从URL中删除index.php: -
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]
Run Code Online (Sandbox Code Playgroud)
我在阅读搜索URL时准备搜索URL和urldecode()时使用urlencode().
问题
只有正斜杠字符会破坏导致404页面未找到错误的URL.例如,如果我搜索one/two
URL是
http://project_name/browse_by_exam/type/tutor_search/keyword/one%2Ftwo/new_search/1/search_exam/0/search_subject/0/page_sort/
Run Code Online (Sandbox Code Playgroud)
我该如何解决?我需要将index.php隐藏在URL中.否则,如果不需要,那么正斜杠就没有问题了,我可以使用这个URL: -
http://project_name/index.php?browse_by_exam/type/tutor_search/keyword/one
%2Ftwo/new_search/1/search_exam/0/search_subject/0
Run Code Online (Sandbox Code Playgroud) 升级到spring security 4.2.4后,我发现StrictHttpFirewall现在是默认设置.不幸的是,它与弹簧MVC @MatrixVariable的效果不佳,因为";" 是不允许的.怎么解决这个问题?
例:
@GetMapping(path = "/{param}")
public void example(@PathVariable String param,
@MatrixVariable Map<String, String> matrix) {
//...
}
Run Code Online (Sandbox Code Playgroud)
这可以像这样调用:
mockMvc.perform(get("/someparam;key=value"))
Run Code Online (Sandbox Code Playgroud)
并填充矩阵图.现在Spring安全阻止了它.
org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL contained a potentially malicious String ";"
at org.springframework.security.web.firewall.StrictHttpFirewall.rejectedBlacklistedUrls(StrictHttpFirewall.java:140)
Run Code Online (Sandbox Code Playgroud)
我可以使用一个允许分号的自定义HttpFirewall.有没有办法在不使用禁用字符的情况下使用@MatrixVariable?
以来:
5.0.1
我想这是向后移植的?