我有一个 Grails 应用程序,其中一些页面只能通过 https 和一些通过 http 访问。这很容易使用前置过滤器处理。但是,当控制器在 https 页面上进行重定向时,用户最终会返回 http 并被过滤器再次定向到 https。
def update = {
...
redirect(action: "show", id: domainInstance.id)
}
在 Firebug 中,我得到:
POST ... localhost:8443 (the form submit to controller)
GET ... 302 ... localhost:8080 (the redirect to show in controller)
GET ... 301 ... localhost:8443 (the redirect back to https in filter)
如何让控制器重定向调用“记住”当前协议等?还是我做错了什么?