我希望得到一些关于如何使用带有ember-simple-auth的ember初始化程序将用户从HTTP重定向到HTTPS的建议 .
`import ENV from 'cio/config/environment'`
SSLInitializer =
name: 'ssl'
before: 'simple-auth-cookie-store'
initialize: (container, application) ->
application.deferReadiness()
# Redirect if hitting HTTP and SSL is enabled
if ENV.SSL and window.location.protocol is "http:"
window.location.href = "https:" + window.location.href.substring(window.location.protocol.length)
return false
application.advanceReadiness()
`export default SSLInitializer`
但是,即使if语句的计算结果为true,cookie似乎也会失效 . 我尝试了几件事,包括:
之前:'simple-auth'
之前:'store'
在设置window.location.href之前,if语句中的
application.destroy()
在此方法有效之前,因为我们在index.html中有简单的代码段,但是我们希望将它保存在初始化程序中 . 有什么建议?
谢谢!