Rails应用程序尝试重定向到https [英] Rails app tries to redirect to https

查看:100
本文介绍了Rails应用程序尝试重定向到https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将现有的https rails应用程序部署到登台服务器,由于某种原因,我一直重定向到该站点的https版本(这是生产服务器上的所需行为,但不是在登台服务器上的行为)我正在部署).在登台服务器上,重定向到https后不返回任何内容.

I'm deploying my existing https rails app to a staging server, and for some reason I keep getting redirected to the https version of the site (which is the desired behavior on the production server, but not on the staging on to which I'm deploying). On the staging server it doesn't return anything after getting redirected to https.

当我在浏览器中键入my.ip.add.ress时,它将重定向到https://my.ip.add.ress.我已经检查过config.force_ssl = false.我的应用程序中似乎没有任何其他功能可以重定向到ssl(在我的应用程序中搜索了所有出现的ssl和https). rails c production启动正常.

When I type in my.ip.add.ress in the browser, it redirects to https://my.ip.add.ress. I've checked that config.force_ssl = false. There does not appear to be any other function in my app that would redirect to ssl (searched for all occurrences of ssl and https in my app). rails c production boots up fine.

我什至不确定我的应用程序是否成功,因为未写入我的production.log. apache是​​否可以尝试重定向到ssl? apache2.conf( https://wiki.apache.org/httpd/RewriteHTTPToHTTPS ).

I'm not even sure my app is getting hit, as my production.log isn't being written to. Could apache be trying to redirect to ssl? There are no such directives in the apache2.conf (https://wiki.apache.org/httpd/RewriteHTTPToHTTPS).

我正在使用乘客"模块运行Apache2.我的应用程序中没有.htaccess文件.这是一个Rails 3.2应用程序.

I'm running Apache2 with the Passenger module. I don't have a .htaccess file in my app. It's a Rails 3.2 app.

推荐答案

在某一时刻您是否拥有"force_ssl = true"?这将创建一个永久重定向.清除缓存可以解决该问题.

Did you have "force_ssl = true" at one point? That would create a permanent redirect. Clearing your cache will fix that.

或者您已经在该域上设置了严格传输安全性"标头?这也将强制重定向到HTTPS版本.要在chrome中将其关闭,请导航至"chrome://net-internals/#hsts".然后删除该域.您可以先查询它,以查看缓存中是否存在.

Or perhaps you've set the "Strict-Transport-Security" header on that domain? That would also force a redirect to the HTTPS version. To turn that off in chrome, navigate to "chrome://net-internals/#hsts". Then delete that domain. You can query it first, to see if exists in the cache.

这篇关于Rails应用程序尝试重定向到https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆