简体   繁体   English

将旧的SSL域重定向到Heroku上的新域(带有Rails 3)

[英]Redirecting an old SSL domain to a new one on Heroku (w/ Rails 3)

I've been googling for the past hour on this but can't quite get it nailed down. 在过去的一个小时中,我一直在搜索该信息,但无法完全确定。 Perhaps you guys can assist here! 也许你们可以在这里提供帮助!

Here's what I'm trying to do: 这是我想做的事情:

Old site is: 旧站点是:

old.tld old.tld

New site is: 新站点是:

new.tld new.tld

A bunch of folks access one particular legacy url on the old site via SSL, ie: 一群人通过SSL访问旧站点上的一个特定旧网址,即:

https://www.old.tld/old_url https://www.old.tld/old_url

I've just setup a brand new site on Heroku, running Rails 3, on the new domain. 我刚刚在Heroku上建立了一个全新的站点,并在新域上运行Rails 3。

I also have installed Heroku's SSL Endpoint Add-on and am using a new secure subdomain: 我还安装了Heroku的SSL端点加载项,并且正在使用新的安全子域:

secure.new.tld secure.new.tld

I've got a bunch of redirects & constraints in my Rails routes.rb to redirect old -> new and pass the appropriate requests. 我的Rails route.rb中有很多重定向和约束,用于重定向旧->新并传递适当的请求。 Everything works perfectly for the non-SSL stuff. 对于非SSL内容,一切都可以完美运行。

The only thing I can't seem to get working properly is the redirects of 我似乎无法正常工作的唯一一件事是

https://www.old.tld/old_url -> https://secure.new.tld/new_url https://www.old.tld/old_url- > https://secure.new.tld/new_url

Safari doesn't seem to mind, but Chrome is throwing a "This is probably not the site you are looking for!" Safari似乎并不介意,但Chrome抛出“可能不是您要查找的网站!” error. 错误。 It says (only when trying via SSL): 它说(仅在通过SSL尝试时):

"You attempted to reach www.old.tld, but instead you actually reached a server identifying itself as secure.new.tld" Etc. “您试图访问www.old.tld,但实际上是到达了一个将自身标识为secure.new.tld的服务器。”

(which is exactly what I want, but Chrome doesn't seem to approve ;) (这正是我想要的,但是Chrome似乎不赞成;)

Any thoughts on how to properly configure? 关于如何正确配置有什么想法?

The seamless solution it is to get a SAN (Subject Alternative Name) certificate that has both the old name and the new name. 无缝解决方案是获取同时具有旧名称和新名称的SAN(主题备用名称)证书。

Another way is to insert a non-secure request in between the two secure requests: redirect from https://www.old.tld -> http://secure.new.tld -> https://secure.new.tld . 另一种方法是在两个安全请求之间插入一个非安全请求:从https://www.old.tld- > http://secure.new.tld- > https://secure.new.tld重定向 I haven't actually tested this, but it should work in theory. 我没有实际测试过,但理论上应该可以。 If it doesn't "just work", then you might try adding an actual page at http://secure.new.tld with a message and a link to https://secure.new.tld . 如果它“不起作用”,那么您可以尝试在http://secure.new.tld上添加一个实际页面,并显示一条消息和指向https://secure.new.tld的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM