Your production web site is delivered over SSL and has a beautiful green padlock in your users' browsers. But your dev environment uses plain old HTTP, or maybe SSL with a self-signed certificate that your browser doesn't recognise.
That's OK, but you're missing out on some nice stuff. For instance, some browsers will warn you if you're delivering mixed content over SSL (like a link to an image that's on plain old HTTP). If you don't see this until you release then you're not doing your users any favors.
So here's how I got my dev environment to give me a green padlock while I'm writing code:
Domains are pretty cheap these days. I registered a new domain for my dev environment - let's call it myapp.systems
Then I set up A records with my DNS provider pointing to 127.0.0.1 for the bare domain and wildcard subdomains (my app uses subdomains for users' accounts)
It doesn't need to be an EV certificate, anything issued by a CA recognised by your browser will do. I needed a wildcard certificate because my app uses subdomains so it cost me $100. Soon Let's Encrypt will start issuing free certficates so cost won't be an issue in the future.
Unlike many other developers my main OS is Windows. This isn't a great platform for Ruby on Rails development so I run an Ubuntu VM that has my dev environment on it.
What I'm saying is that when I launch my Rails app, I can't just go to http://localhost:3000 to see it. This isn't a problem because I'm running nginx on my main machine and it redirects all localhost traffic to my Ubuntu VM. Easy to set up as I'll describe below:
- Install nginx (should be trivial on most platforms)
- Change the
nginx.conffile so that nginx is listening on port80for HTTP and443for SSL. - Change the
nginx.conffile so that it uses the certificates you bought above - Change the
nginx.conffile so that it passes all traffic through to your dev environment (may belocalhostif your setup is simpler than mine)
Sample nginx.conf file is attached. Restart nginx and you're good to go.
When you go to https://myapp.systems you'll see a 502 Bad gateway page if your dev server isn't running. If it is running you should see the app with a nice green padlock.