# HTTPS

What is HTTPS?

HTTPS is ordinary HTTP carried inside an encrypted [TLS](/glossary/tls) connection. The requests and responses are the same as with plain HTTP, but nobody on the network between the browser and the server can read or change them. The browser also knows it reached the real server, because the server presented a valid [SSL certificate](/glossary/ssl-certificate) for the hostname.

## How it works

When a browser opens `https://example.com`, it connects to port 443 by default, runs the TLS handshake and verifies the certificate. Only then does it send the HTTP request, through the encrypted channel. Everything inside that channel is protected: the path, the query string, the headers, the cookies and the body. What the network can still see is the server's IP address and, in most setups, the hostname, which the client sends during the handshake.

A site that serves HTTPS usually also redirects every plain HTTP request to the HTTPS address:

```text
HTTP/1.1 301 Moved Permanently
Location: https://example.com/
```

On top of that it sends an [HSTS](/glossary/hsts) header, so the browser goes straight to HTTPS on later visits, and it marks its cookies `Secure`, so they are never sent over plain HTTP.

## Why it matters

Browsers label plain HTTP pages as not secure, and they reserve some features, such as service workers, for secure pages. Logins, session cookies, payment forms and API tokens all depend on the connection being encrypted. Search engines, payment providers and many APIs expect HTTPS as a baseline.

## What can go wrong

- The certificate expires, and every visitor gets a full-page browser warning instead of your site.
- Mixed content: an HTTPS page loads a script, stylesheet or image over plain HTTP. Browsers block or upgrade such requests, so parts of the page break.
- A redirect loop. A proxy or CDN in front of your app talks to it over plain HTTP, the app does not trust the header that says the visitor used HTTPS, and it keeps redirecting to HTTPS.
- No redirect from HTTP at all, so visitors who type the bare domain stay on the unencrypted version.

## Check it

The [SSL/TLS certificate checker](/tools/ssl-checker) opens a live TLS connection to any domain and shows the certificate's issuer, validity dates, days until expiry, covered hostnames and the negotiated protocol. Ranetrace's [certificate monitoring](/features/certificate-monitoring) re-checks it every hour and warns you before it expires.

Read this definition in a browser: https://ranetrace.com/glossary/https
