1

我正在使用带有 Spring Security 插件的 Grails 2.1。我有一些设置了 REQUIRES_SECURE_CHANNEL 的路径。当我使用“grails run-app -https”在我的机器上运行我的应用程序时,当从 http 访问需要 https 的路径时,一切正常(它们被重定向)。但是,在需要 https 的 Amazon Elastic Beanstalk 路径上,不会从 http 重定向到 https。

我已经设定

grails.plugins.springsecurity.secureChannel.useHeaderCheckChannelSecurity = true 

在 Config.groovy 中用于生产和

grails.plugins.springsecurity.secureChannel.useHeaderCheckChannelSecurity = false

在 Config.groovy 中进行开发。

如果我远程登录到端口 80 并请求设置了 REQUIRES_SECURE_CHANNEL 的路径,这就是我在 Amazon Elastic Beanstalk 上看到的内容:

$ telnet www.example.com 80
Connected to www.example.com.
Escape character is '^]'.
GET /login/index HTTP/1.1
Host: www.example.com

HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
Location: http://www.example.com/login/index
Content-Length: 0
Date: Wed, 10 Oct 2012 19:40:29 GMT

如果我使用开发环境远程登录到端口 8080 并请求设置了 REQUIRES_SECURE_CHANNEL 的路径,这就是我在我的机器上看到的:

$ telnet localhost 8080
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET /server/login/index HTTP/1.1
Host: localhost:8080

HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
Location: https://localhost:8443/server/login/index
Content-Length: 0
Date: Wed, 10 Oct 2012 19:27:09 GMT

如何让我在 Amazon Elastic Beanstalk 上的应用程序正确转发将 REQUIRES_SECURE_CHANNEL 设置为从 http 到 https 的路径?

4

0 回答 0