你如何处理开发中的SSL? [英] How do you handle SSL in development?

查看:115
本文介绍了你如何处理开发中的SSL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它将一些路由的HTTPS与 ssl_requirement 插件结合使用。它已经部署并且在生产中运行良好。

I have an application that uses HTTPS for some of its routes in conjunction with the ssl_requirement plugin. It's deployed and is working fine in production.

问题是在开发过程中如何最好地处理这个问题,因为目前我只是在攻击我的 routes.rb 删除:requirements 键,显然这不是很方便或优雅:

The question is how best to handle this in development, because at the moment I'm simply hacking my routes.rb to remove the :requirements key and obviously that's not very convenient or elegant:

map.resource :session, :controller => 'session',
                       :only => [:new, :create, :destroy],
                       :requirements => { :protocol => 'https' }

理想情况下,我希望能够运行我的应用程序的安全部分在没有任何变化的情况下开发Mongrel。我怎样才能做到这一点?我正在使用Mac OS X.

Ideally I'd like to be able to run the secure parts of my application in development on Mongrel without any changes. How can I achieve this? I'm using Mac OS X.

推荐答案

不要担心开发中的SSL

对于开发环境IMO,您不需要运行SSL。这不值得花时间或麻烦,尤其是随着更多人加入团队。关于你的路线,我只是在开发环境中将协议保持为 http

For a development environment, IMO, you don't need to run SSL. It's not worth the time or hassle, especially as more people join the team. With regards to your routes, I would simply keep the protocol as http in the development environment:

protocol = Rails.env.development? ? "http" : "https"

map.resource :session, :controller => 'session',
                       :only => [:new, :create, :destroy],
                       :requirements => { :protocol => protocol }

现在,你的地方需要测试你的SSL集成是在暂存环境中 - 在部署到生产之前部署到的位置。您可以在此处准确复制生产环境。您的开发环境不需要以相同的方式匹配您的生产环境。

Now, where you do need to test your SSL integration is on your staging environment -- the place where you deploy to just prior to deploying to production. This is where you want to accurately replicate your production environment. Your development environment does not need to match your production environment in this same way.

这篇关于你如何处理开发中的SSL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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