Skip to content
Log In Sign Up info@muvcloud.com

The Short Answer

HTTP is the protocol browsers and servers use to exchange pages. On its own it sends everything as readable text, including passwords and cookies. HTTPS runs the same protocol inside a TLS connection, which encrypts it and proves the server's identity with a certificate.

HTTPHTTPS
EncryptionNoneTLS
Default port80443
CertificateNot usedRequired
Browser labelNot secureNo warning
HTTP/2 and HTTP/3Not in browsersYes

What HTTPS Protects

  • Confidentiality: the content of every request and response is encrypted: pages, form data, cookies, and the path and query string of the address.
  • Integrity: a network in between cannot inject content or change a download without the browser noticing.
  • Authentication: the certificate shows that the server is entitled to use the domain name.

The handshake that sets this up is explained in what is SSL/TLS.

Certificates

A certificate binds a domain name to the server's public key and is signed by a certificate authority that browsers trust. Let's Encrypt issues domain-validated certificates through an automated process, and Certbot requests, installs, and renews them; see Certbot with Nginx. When a certificate has expired, was issued for another name, or comes from an authority the browser does not trust, the browser shows a full-page warning instead of the site; see Your connection is not private.

Ports 80 and 443

HTTP listens on TCP port 80 and HTTPS on TCP port 443; HTTP/3 adds UDP 443. A site that uses HTTPS still keeps port 80 open to redirect typed addresses and to answer certificate validation. The details are in port 80 and port 443.

What HTTPS Does Not Hide

  • The domain name: the DNS lookup and, in most connections, the server name sent at the start of the TLS handshake show which site is visited, though not which page.
  • Addresses, timing, and sizes: a network still sees who talks to whom, when, and how much.
  • The honesty of the site: the padlock proves the connection is private, not that the site is trustworthy. A phishing site can have a valid certificate.
  • The server: data is decrypted on arrival. Securing the server and the application is a separate job.

Redirect HTTP to HTTPS

Once HTTPS works, send every HTTP request to the same address over HTTPS with a permanent redirect. In Nginx:

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;
    return 301 https://$host$request_uri;
}

Test with sudo nginx -t, reload, and check with curl. More detail is in how to redirect HTTP to HTTPS in Nginx.

HSTS

HTTP Strict Transport Security is a response header that tells browsers to use HTTPS for the domain for a set time without trying HTTP first, which closes the gap of that first unencrypted request. Add it only when HTTPS works for every subdomain it covers, because browsers will refuse plain HTTP for the whole period. Start with a short max-age, such as 300 seconds, and raise it once you are sure, for example in Nginx with add_header Strict-Transport-Security "max-age=31536000" always;.

HTTP/2 and HTTP/3 Need HTTPS

The HTTP/2 standard allows use without encryption, but browsers only use HTTP/2 over TLS, and HTTP/3 always encrypts because QUIC has TLS built in. Moving to HTTPS is therefore also the way to the newer protocols: many requests over one connection, compressed headers, and with HTTP/3, quicker connection setup on lossy networks.

Check a Site

curl -sI http://example.com/ | grep -i -E '^(HTTP|location)'
curl -sI https://example.com/ | head -1
curl -sI --http2 https://example.com/ | head -1

The first should show a 301 with a Location pointing to https://. The second shows the status over HTTPS, and the third shows which protocol version the server agreed to.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations