ruby-on-rails – 带有Ruby on Rails的SSL

我需要做什么来获取流量到我的 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

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...