How I Accessed Geolocation Using Free SSL From CloudFlare

A few months ago, DarkSky.net announced that they would be shutting down my favourite weather app, Forecast.io (😭). Their main site, as well as their API would still be available and remain supported. I wasn’t enrolled in HackerYou at that time, but I planned on saving this API to use towards my own personal project to revive my favourite weather app. After our second week of JavaScrip tat HackerYou, I decided this would be the time to put my knowledge to good use.

I wanted to start with something basic since I knew I wasn’t an app developer. This is what I was able to put together: http://meaganpau.com/forecast

For security purposes, Chrome and Safari don’t support geolocation without an SSL certificate (which is what makes HTTPS work). In order to setup SSL on my site to allow for geolocation, I used the free service, CloudFlare. Here are the steps I took!

  1. I signed up for an account on https://www.cloudflare.com/ . Pretty standard so far!
  2. Once my account was all setup, I had to change the nameservers on my domains to the ones that CloudFlare provided.
  3. I created a free Origin Certificate, and it gave me a super long certificate code to copy onto my hosting side. I currently use Bluehost for my hosting, so I just had to go to the cPanel > SSL/TLS Manager > Certificates
  4. I also ordered an Edge Certificate on CloudFlare, which should then provide you a key to put onto your hosting side as well. On Bluehost, just paste the code into cPanel > SSL/TLS Manager > Private Keys
  5. From here, all I had to do was wait. After a couple hours, my site was HTTPS! :) Also, the Crypto on CloudFlare should say that the SSL has an Active Certificate.
  6. BONUS STEP! I noticed that a few of my projects on my subdomains had broke since the HTTPS was causing errors. I fixed this by going into CloudFlare > Page Rules and creating a rule to only target my Forecast app to be in HTTPS. That way, my other projects won’t be affected. CloudFlare allows for 3 free page rules, so make sure you use them wisely (or of course, you can buy more).