1
在生产环境中的应用不能映射404错误页面,春季安全插件始终重定向到登录页面“,并返回一个错误302在Tomcat中日志接入)移动temporaly- )误差的控制器春季安全+ 404错误
@Secured(['permitAll'])
class ErrorsController {
def error401() {
render view: '401'
}
def error403() {
render view:'403'
}
def error404() {
render view:'404'
}
def error500() {
render view:'error'
}
def error503() {
render view:'503'
}
}
2)URL映射
static mappings = {
"/" {
controller = "dashboard"
action = { 'index' }
view = { 'index' }
}
"/$controller/$action?/$id?"{
constraints { controller(matches:/^((?!(api|mobile|web)).*)$/) }
}
"401"(controller: "errors", action: "error401") // session timeout
"403"(controller: "errors", action: "error403")
"404"(controller: "errors", action: "error404")
"500"(controller: "errors", action: "error500")
"500"(controller: "errors", action: "error403", exception: AccessDeniedException)
"500"(controller: "errors", action: "error403", exception: NotFoundException)
}
因此,当在生产模式而已,我生成假网址模式,没有重定向到 “404” 就可以解决。任何想法 ?
哇 - 这是非常没有答案。这只会禁用整个网站的安全性。 –