Rails 3 Heroku上的SSL [英] Rails 3 SSL on Heroku

查看:125
本文介绍了Rails 3 Heroku上的SSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



理想情况下,我想设置'基于主机名的SSL' (http://addons.heroku.com/ssl),但Heroku收取每月20美元的费用,这对我来说似乎有点陡峭。



Heroku确实通过捎带他们的证书提供一个免费的SSL解决方案,但是你必须使用他们的域名(https://yourapp.heroku.com)



我想我会将我的付款页面指向此URL,然后在处理完事务后将用户重定向回我的自定义URL。我在使用这个解决方案时遇到的问题有:


  1. 当您在交易后将用户重定向到自定义网址时,我的flash消息将不会显示,因为它与heroku URL的cookie相关联。如何将闪回消息发送回自定义域?

  2. 如果用户点击付款页面上的任何菜单链接,它们将被发送到托管在Heroku上的页面URL。由于我所有的链接都是相对于根域的。有没有一种方法可以强制生成所有网址(我在菜单中使用'url_for'链接)来使用完整的自定义网址?



<除非有人可以完全建议替代解决方案?



谢谢

解决方案

像这样?
$ b

  url_for(:only_path => false,:host =>'your-app.heroku.com',:protocol =>:https) 


I am currently developing am e-commerce app in Rails 3.0.9 and it is hosted on Heroku.

Ideally I would like to set 'Hostname based SSL' (http://addons.heroku.com/ssl), but Heroku charges a fee of $20/month which seems a bit steep for me right now.

Heroku does offer a free SSL solution by piggybacking off their certificate, however you would have to use their domain (https://yourapp.heroku.com)

I was thinking I would direct my payment page to this URL and then redirect the user back to my custom URL after the transaction has been processed. The problems I'm have with using this solution are:

  1. When you redirect the user back to the custom url after the transaction, my flash message will not be displayed as it is tied to the cookie of the heroku URL. How can I send the flash message back to the custom domain?
  2. If the user clicks on any of the menu links on the payment page, they will be sent to a page hosted on the Heroku URL. Since all my links are relative to the root domain. Is there a way of forcing all URLs generated (I am using 'url_for' links in my menu) to use the full custom domain urls?

Unless someone can suggest an alternate solution altogether?

Thanks

解决方案

Like this?

url_for(:only_path => false, :host => 'your-app.heroku.com', :protocol => :https)

这篇关于Rails 3 Heroku上的SSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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