Skip to content

Instantly share code, notes, and snippets.

@brasic
Forked from trcarden/gist:3295935
Last active August 29, 2015 13:55
Show Gist options
  • Save brasic/8788958 to your computer and use it in GitHub Desktop.
Save brasic/8788958 to your computer and use it in GitHub Desktop.
simulating a real https site in localhost:3000 (OSX)
running https://yourssldomain.com
# generate keys, run in ~/.sslcert
openssl genrsa -des3 -out server.orig.key 2048
openssl rsa -in server.orig.key -out server.key
openssl req -new -key server.key -out server.csr
# set Common Name: yourssldomain.com
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
echo "127.0.0.1 yourssldomain.com" | sudo tee -a /private/etc/hosts
# redirect localhost:443 to localhost:3000 so rails doesn't need to be root
sudo ipfw add 100 fwd 127.0.0.1,3000 tcp from any to any 443 in
# start rails, run this in repo
$ thin start --ssl --ssl-verify --ssl-key-file ~/.sslcert/server.key --ssl-cert-file ~/.sslcert/server.crt
# (optional) Add server.crt as trusted !!SYSTEM!! (not login) cert in the mac osx keychain
# Open keychain tool, drag .crt file to system, and trust everything.
@brasic
Copy link
Author

brasic commented Feb 18, 2014

Line 10 should no longer be necessary as vitae no longer has domain requirements, so any existing .lo.peopleadmin.com domain should work, since they already point to localhost. You will get a warning if you use this for sites other than the one you generated the cert for, but there are going to be other warnings anyway.

After this you should be able to reach a running local instance at e.g. https://academicpositions.harvard.lo.peopleadmin.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment