【问题标题】:Why is https being forced locally?为什么在本地强制使用 https?
【发布时间】:2017-07-06 18:37:44
【问题描述】:

我最近在获得证书后在我的production.rb 中添加了一个简单的config.force_ssl。没有向development.rb 添加任何内容。

我将其推送到生产环境,并尝试在本地运行,但现在 https 被强制在 localhost:3000 上运行。

所以我首先尝试将config.force_ssl修改为config.force_ssl = true unless Rails.env.development?。请记住,这条线只存在于production.rb 中。还是被逼的。

然后我尝试完全注释掉这条线。还是被逼的。

我每次都重启服务器。

我正在用工头启动服务器。我的 procfile 是:

web: rails s -p 3000
client: sh -c 'rm app/assets/webpack/* || true && cd client && bundle exec rake react_on_rails:locale && yarn run build:development'

第一次执行此操作时是否缓存了某些内容?

我的 Procfile 的 client 部分有什么作用吗?

【问题讨论】:

  • 你试过重启spring了吗?
  • 如果您的意思是使用spring stop,那么可以。什么都没有。

标签: ruby-on-rails ssl initialization config development-environment


【解决方案1】:

这是由于您的浏览器缓存造成的,请尝试清理您的缓存和应用数据或使用其他浏览器。

如果您的localhost 位于https 中,那么除非浏览器缓存和数据被删除,否则它仍将使用https

您还可以更改运行 rails 应用程序的端口。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-26
    • 1970-01-01
    • 1970-01-01
    • 2018-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多