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」 就可以解決。任何想法 ?
哇 - 這是非常沒有答案。這隻會禁用整個網站的安全性。 –