我需要做什么来获取流量到我的
ruby在rails应用程序使用https?我安装了一个证书,如果在访问该网站时手动输入地址栏中的“https://”,则会出现小锁图标,但是只需手动访问我的浏览器中的www.example-app.com就可以通过http ://.
有一些单行配置还是比这更复杂?我从来没有必须处理过SSL,所以请原谅我,如果我听起来不知道发生了什么.
我在MediaTemple的主持人(gs),如果重要或任何人有这样的设置的经验.
解决方法
查看
ssl_requirement宝石.
它允许您在控制器中指定哪些操作应通过https提供,哪些操作可以通过https提供.然后,它将重新定位从http到https,反之亦然.
从文档:
- class ApplicationController < ActiveRecord::Base
- include SslRequirement
- end
- class AccountController < ApplicationController
- ssl_required :signup,:payment
- ssl_allowed :index
- def signup
- # Non-SSL access will be redirected to SSL
- end
- def payment
- # Non-SSL access will be redirected to SSL
- end
- def index
- # This action will work either with or without SSL
- end
- def other
- # SSL access will be redirected to non-SSL
- end
- end