1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > java 重定向 https_使用简单身份验证从HTTP重定向到HTTPS

java 重定向 https_使用简单身份验证从HTTP重定向到HTTPS

时间:2024-07-27 22:41:03

相关推荐

java 重定向 https_使用简单身份验证从HTTP重定向到HTTPS

我希望得到一些关于如何使用带有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中有简单的代码段,但是我们希望将它保存在初始化程序中 . 有什么建议?

谢谢!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。