Using Cloudflare for (free) HTTPs
If you’ve completed the making a Hugo Site the hard way blog series, you may encounter an annoying issue. Your blog will probably be unsecured on HTTP rather than the encrypted HTTPS. Getting an SSL certificate with cloud providers like Google Cloud requires renting out a load balancer which can cost upwards of $20/month!
There is a free alternative in the form of Cloudflare which provides SSL certification for free via proxy.
Change name servers to Cloudflare’s
First you will need to setup an account with Cloudflare. Add your site to CloudFlare and go under DNS. You should see CloudFlare’s name servers.
You can replace the name servers for your domain in your cloud provider’s interface. Here is how it looks like in Google Cloud Domains:
You will also need to add CNAME records to Cloudflare’s DNS settings for your domain.
Activate SSL/TLS settings in Cloudflare
You can setup encryption in Cloudflare’s SSL settings menu like so:
Either Flexible
or Full
should work.
Add a Page Rule
Finally you want to redirect your “www” subdomain traffic (ie: http://www.mysite.net) to the root domain (ie: https://mysite.net) using a Page Rule.
Go to Rules » Page Rules and
Updating the site
If you are using a tool like HUGO you may want to update the baseURL in the config.toml
to be https:
baseURL = "https://mysite.com"
Note: At this point you may also encounter issues with certificates, especially if you did not set up your DNS with Cloudflare to begin with. If you encounter prolonged trouble with this, I recommend trying out a new domain registered with Cloudflare to begin with.
References:
Related Posts
Making an ECS WebAssembly Game with Rust and Bevy
Why Rust for games specifically? To follow-up on my previous write-up wherein I describe the rationale for learning Rust, I decided to tackle the learning experience through writing a game.
Read moreWhy Learn Rust?
Recently, I decided to take some time to learn the Rust programming language. In my day-to-day job as a machine learning engineer working in bio-tech, largely using Python, I’ve started to notice the limitations and faults of using weakly-typed poor performance languages for production.
Read moreStable Diffusion - De-painting with Stable Diffusion img2img
Stable diffusion has been making huge waves recently in the AI and art communities (if you don’t know what that is feel free to check out this earlier post).
Read more