Securing your website in 4 minutes - What, Why and How of HTTPS
Tags: https, dns, web, webdev
Published: 2018-08-21 02:07:02

---
title: Securing your website in 4 minutes - What, Why and How of HTTPS
published: true
description: What HTTPS is, why you should have it, and how to get it. All in 7 minutes.
tags: https, dns, web, webdev
---

![Donzo](https://thepracticaldev.s3.amazonaws.com/i/u5l7rzt4uog7lyvgsi32.png)

Today I changed my website's protocol from HTTP to HTTPS - it was quick and easy. After finishing, I wasn't sure what I had really accomplished, so I did some research into what it really meant to create a secure connection between you and a website. 

## Here is a quick summary.

When you submit a body of text to a website (e.g. log-in info, chat message, search query), the information is sent to a server that may return information back to you. This exchange of information happens using the _HyperText Transfer Protocol_.  The issue is the vulnerability of this information; any person intercepting this network can see your message, this is not good for your data. 

![Catch from Wireshark](https://thepracticaldev.s3.amazonaws.com/i/f9d35vdx87b0x6ow1gg2.png "No bueno")
Image: this is a sample package sent from my computer to my site before changing the protocol. Caught using Wireshark.

This vulnerability is the reason why HTTPS (HTTP + _Secure_) is strongly encouraged. 

This protocol encrypts your message and sends a public key to the recipient through SSL certificates. This public key is used for end-to-end encryption, or to verify certificate signatures (thanks to Vin in the comments for clarification). 

### What if I don't send/receive sensitive data from my website? 

HTTPS has more benefits other than just securing the exchange of information: 
- Ward off intruders from identifying your users by analyzing your information exchange.
- Reduce the risk of anyone exploiting the resources of your website to their benefit.
- As Progressive Web Apps grow in popularity, Service Workers (used for push notifications) require the use of HTTPS.
- Other benefits of Service Workers include offline behavior and caching.

## Changing your website to use HTTPS

![Site before changing protocol to HTTPS](https://thepracticaldev.s3.amazonaws.com/i/aqllhzrum9j2otepsel6.png)

There is a 5 minute video made by [httpsiseasy](https://httpsiseasy.com/) explaining how to do this. Here is their step by step tutorial I followed using Cloudflare. 
- Go to [Cloudflare](https://www.cloudflare.com/)
- Sign up
- Enter your website's domain. Enter, free, continue, enter
- The service will give you two DNS nameservers along with instructions to add it to your website.
- Hit Crypto on the toolbar, change "Always Use HTTPS" to On

Do this and you're donzo, the change may take from several minutes up to 48 hours, but nothing else is needed from you. 

![Site after changing protocol to HTTPS](https://thepracticaldev.s3.amazonaws.com/i/sz1rml131nh66yzyxqlp.png)

After doing this, I was chatting with my brother ([@sammyisra](https://dev.to/sammyisa)) and told him I used Cloudfare to do this, he told me he had used Netlify. I'm curious what most people have used, please leave a comment below sharing what service you used and why.

Thank you!

### Other useful resources:
- [Google - Why HTTPS Matters](https://developers.google.com/web/fundamentals/security/encrypt-in-transit/why-https)
- [Instant SSL - What is HTTPS](https://www.instantssl.com/https-tutorials/what-is-https.html)