为什么 IP(域)地址重定向到本地主机而不是 Grails 中的 IP(域)

Why IP(Domain) address redirect to localhost instead of IP(Domain) in Grails

这是我的本地域名

http://10.10.1.101/uxsurvey/profile/dashboard

在控制器中我为用户列表设置了一个动作

redirect(controller: "Profile",action:"userlist" ,params: [profileID: email]);

它重定向 http://localhost/uxsurvey/profile/userlist 而不是 http://10.10.1.101/uxsurvey/profile/userlist

Grails redirect() 方法将使用 Config.groovy 中的 grails.serverURL 属性 作为目标地址或本地主机中的域,如果所述配置 属性 未指定且应用程序未指定运行宁在生产环境中。因此,您应该在 Config.groovy 中将 grails.serverURL 设置为“10.10.1.101”,或者 运行 您在生产模式下的应用程序。