2012-06-25 20 views
7

Ho bisogno di testare come si comportano alcuni elementi della mia pagina quando accedo a HTTPS - Mi chiedevo come avrei potuto testare questa app sinatra localmente con HTTPS. Mi scuso se la mia domanda non ha senso, ma mi piacerebbe collegarmi a localhost tramite il mio browser web su HTTPS.Testare localmente HTTPS su Sinatra

+0

Cosa web sono in esecuzione Sinatra attraverso? – Larsenal

+0

@Larsenal sottile. Quindi forse questa è una domanda sottile? –

risposta

7

Risposta breve: è possibile creare un certificato autofirmato per lo sviluppo locale. Heroku ha un breve articolo su how to create a self-signed SSL cert.

Una volta creato il vostro cert e la chiave, è piuttosto semplice, con sottile:

server di
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 
+1

'bundle exec thin start -p 3001 -R config.ru --ssl --ssl-key-file ~/.ssl/server.key --ssl-cert-file ~/.ssl/server.crt' ha funzionato per me – eebbesen