此处的管理员将grails应用程序移动到新子网并更改了DNS。然而,我的应用程序继续重定向并创建到以前的子网/ DNS的链接。我搜索了我的项目是否使用了旧的DNS而没有任何命中。
这就是重定向逻辑的样子:
withFormat {
// Browsers re-direct to prevent multi-submit issues, the others just get the data of the created Evaluation
html {
flash.message = message(code: 'default.created.message', args: [message(code: 'evaluation.label', default: 'Evaluation'), evaluationInstance.id])
flash.messageType = "success"
redirect(
mapping: "restChild",
params: [
parent:'performanceReview',
parentId: evaluationInstance.performanceReview.id,
id: evaluationInstance.id
]
)
}
json {
response.status = 201
response.setHeader("Location", createLink(mapping: "restEntity", absolute: true, id: evaluationInstance.id).toString())
forward(action: "show", id: evaluationInstance.id)
}
xml {
response.status = 201
response.setHeader("Location", createLink(mapping: "restEntity", absolute: true, id: evaluationInstance.id).toString())
forward(action: "show", id: evaluationInstance.id)
}
}
这是conf / URLMappings.groovy文件
// RESTful entity mapping
name restEntity: "/$controller/$id"(parseRequest: true) {
action = [GET: "show", PUT: "update", POST: "update", DELETE: "delete"]
constraints {
id matches: /\d+/
}
}
我的问题是,我希望在哪里修复重定向的域名?
答案 0 :(得分:1)
这通常由grails.serverURL
(或外部配置文件)中的grails-app/conf/Config.groovy
配置设置控制
以这种方式生成链接时使用grails.serverURL
中设置的基本网址值:createLink(... absolute: true)
。 Link to reference docs