grails资源未通过https加载

时间:2014-07-16 07:11:20

标签: grails grails-plugin

我正在使用带有资源插件和引导程序的grails!加载页面时,我收到ssl错误,因为我的某些资源未通过https:

加载
The page at 'https://localhost/blogpost/10' was loaded over HTTPS, but displayed
insecure content from 'resource:/fonts/glyphicons-halflings-regular.woff': this
content should also be loaded over HTTPS.

这个文件(glyphicons-halflings-regular.woff)是在bootstrap资源中定义的,所以我不想在文件中对https url进行硬编码。

如何告诉我的系统(grails或资源插件)通过https加载文件?

感谢您的帮助。

托马斯

2 个答案:

答案 0 :(得分:0)

这解决了它。不知道我文件中的问题是什么......

    //resource url:'js/bootstrap.min.js'
    //resource url:'css/bootstrap.min.css'
    resource url:'https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'
    resource url:'https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js'

答案 1 :(得分:0)

我正在使用带有资源插件和引导程序的grails,并且面对同样的"不安全的内容"问题。 为了解决这个问题,我刚刚在config.groovy中完成了这个:

grails.plugin.springsecurity.secureChannel.useHeaderCheckChannelSecurity = true
grails.plugin.springsecurity.portMapper.httpPort = 80
grails.plugin.springsecurity.portMapper.httpsPort = 443
grails.plugin.springsecurity.auth.forceHttps = true
grails.plugin.springsecurity.secureChannel.definition = [ '/**': 'REQUIRES_SECURE_CHANNEL']