你如何在本地运行带有 HTTPs 的 Rails 进行测试? [英] How do you run Rails with HTTPs locally for testing?

查看:34
本文介绍了你如何在本地运行带有 HTTPs 的 Rails 进行测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的开发环境使用 HTTP,生产环境使用 HTTPS,这导致我们无法在本地重现的问题与 HTTPS 相关.

Our dev envs use HTTP, prod uses HTTPS, this is causing issues that we can't reproduce locally with are HTTPS related.

如何在本地运行带有 SSL 的 rails 以进行测试?是否有 Webrick 配置?

How can I run rails with SSL locally for testing purposes? Is there a Webrick config?

谢谢

推荐答案

你应该用来做:

$ sudo apt-get install thin

并在 config/application.rb 中添加这一行

And add this line in config/application.rb

config.force_ssl = true

然后使用命令行在瘦上运行应用程序:

Then run app on thin with command line:

$ thin start --ssl

这篇关于你如何在本地运行带有 HTTPs 的 Rails 进行测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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