Aus*_*ick 12 ssl https ruby-on-rails
我需要做些什么才能让我的ruby在rails应用程序上获得流量以使用https?我安装了证书,如果我在访问网站时在地址栏中手动输入"https://",则会出现小锁图标,但只需在浏览器中手动转到www.example-app.com即可通过http发送流量://.
是否有一些单行配置还是比它更复杂?我以前从来没有处理过SSL,所以请原谅我,如果我听起来不知道发生了什么.
我在MediaTemple中托管(gs),如果这很重要或任何人都有这样的设置经验.
jer*_*ith 14
看看ssl_requirement gem.
它允许您在控制器中指定应通过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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10088 次 |
| 最近记录: |