Testing HTTPS on Sinatra locally
Asked Answered
C

1

7

I need to test how some elements on my page behave when I access it over HTTPS - I was wondering how I could test this sinatra app locally with HTTPS. I apologize if my question doesn't even make sense, but I would like to connect to localhost through my web browser over HTTPS.

Cappella answered 25/6, 2012 at 16:38 Comment(2)
What web server are you running Sinatra through?Conias
@Conias thin. So maybe this is a thin question?Cappella
C
8

Short answer: You can create a self-signed certificate for local development. Heroku has a brief article on how to create a self-signed SSL cert.

Once you've created your cert and key, it's pretty simple with 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
Conias answered 25/6, 2012 at 17:28 Comment(1)
bundle exec thin start -p 3001 -R config.ru --ssl --ssl-key-file ~/.ssl/server.key --ssl-cert-file ~/.ssl/server.crt worked for meHjerpe

© 2022 - 2024 — McMap. All rights reserved.