【问题标题】:Testing HTTPS on Sinatra locally在 Sinatra 上本地测试 HTTPS
【发布时间】:2012-06-26 22:51:19
【问题描述】:

当我通过 HTTPS 访问页面时,我需要测试页面上某些元素的行为 - 我想知道如何使用 HTTPS 在本地测试这个 sinatra 应用程序。如果我的问题甚至没有意义,我深表歉意,但我想通过我的网络浏览器通过 HTTPS 连接到 localhost。

【问题讨论】:

  • 您通过什么网络服务器运行 Sinatra?
  • @Larsenal 瘦。所以也许这是一个很薄的问题?

标签: ruby sinatra thin


【解决方案1】:

简短回答:您可以为本地开发创建自签名证书。 Heroku 在how to create a self-signed SSL cert 上有一篇简短的文章。

创建证书和密钥后,使用 Thin 非常简单:

SSL options:
    --ssl                        Enables SSL
    --ssl-key-file PATH          Path to private key
    --ssl-cert-file PATH         Path to certificate
    --ssl-verify                 Enables SSL certificate verification

【讨论】:

  • bundle exec thin start -p 3001 -R config.ru --ssl --ssl-key-file ~/.ssl/server.key --ssl-cert-file ~/.ssl/server.crt 为我工作
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-11-24
  • 2011-03-11
  • 1970-01-01
  • 2015-03-03
  • 1970-01-01
相关资源
最近更新 更多