我有一个 Rails 6 应用程序。我有一个正在生产的内部版本,但我无法使用 SSL 证书。
我尝试使用以下方法关闭 SSL 重定向:
config.ssl_options = { redirect: false, secure_cookies: false, hsts: false }
在配置/环境/生产.rb中
我正在使用标准 Devise。登录页面通过 http:// 正确提供。但是,当我登录时,页面会重定向到 https:// 版本。
如何防止这种情况发生?
我一直在努力解决同样的问题,直到我在
config/environments/production.rb
中找到此部分:
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
config.assume_ssl = true
该行最初被注释掉,一旦我取消注释,重定向就会停止。
config.force_ssl
是真是假似乎并不重要。
顺便说一句,我正在使用 Rails 7.1.1。