{"canonical_url":"https://engineer.company/glossary/https/","content_markdown":"# HTTPS\n\n## What it is\n\nHTTPS is HTTP sent through a TLS connection. The requests and responses are the\nsame messages as before, with the same methods, status codes and headers; what\nchanges is the connection under them, which is now encrypted and authenticated.\nThe `https` URI scheme is defined in RFC 9110, the HTTP semantics specification\nfrom June 2022, which took over from RFC 2818, the short May 2000 document that\nfirst wrote down HTTP over TLS. Its default port is 443, where plain HTTP uses 80.\n\nRFC 9110 attaches two rules to the scheme. A client MUST confirm that the\nidentity the server presents acceptably matches the host in the address, which\nin practice means the certificate has to cover that name; a connection to the\nwrong name has failed, however strong its encryption. And `http://example.com/`\nand `https://example.com/` are distinct origins with separate namespaces. They\nshare a host name and nothing else, as far as the protocol is concerned.\n\nHTTPS is not tied to one version of HTTP. HTTP/1.1 and HTTP/2 run over TLS on\nTCP. HTTP/3 runs over QUIC, which carries the TLS 1.3 handshake inside the\ntransport, and RFC 9114 rules out using it to reach a plain `http://` server\ndirectly, so the newest version arrives with HTTPS or not at all.\n\nWhat the encryption covers is easiest to see with an address. For\n`https://shop.example/orders/1234?ref=mail`, the path, the query string, every\nheader including cookies and `Authorization`, and both message bodies are\nencrypted. The network between visitor and server still sees the server's IP\naddress and port, the timing and size of the traffic, and in most connections\nthe host name `shop.example` as well: the browser looked it up in DNS, and the\nclient names it in the opening TLS message so that one address can serve many\nsites. HTTPS hides what was asked for, not whom it was asked of.\n\n## Why it matters\n\nThe live question for a public site is whether anything should still answer\non `http://`, and browsers now make most of that call themselves.\n\nThe first lever is the secure context, a W3C term for a page delivered over\nHTTPS or from the machine itself. Browsers keep a growing set of features for\nsecure contexts only. Service workers are one: `navigator.serviceWorker` is\ndeclared for secure contexts, so on a page loaded over plain HTTP the property\nis simply absent, and so is every feature built on it, offline caching first\namong them. The Secure Contexts specification also recommends that authors of\nnew specifications guard sensitive features the same way, so the restriction is\nthe default for new work rather than a case-by-case exception.\n\nThe second lever is mixed content. Once a page is itself HTTPS, the browser\nsorts each of its fetches under the W3C Mixed Content rules. Images, audio and\nvideo requested over `http://` are upgraded to `https://` automatically, and\nthey fail if that address does not answer. Scripts, stylesheets and data\nrequests are blocked outright with a network error. One leftover plain address\nin a template can therefore take out a whole feature, not just a picture.\n\nThat leaves very little for port 80. A listener that answers every request with\na permanent redirect to the same path on `https://` still earns its place,\nbecause people type bare names and old links still say `http://`. The\ncertificate authority's HTTP challenge also arrives there when a certificate is\nissued or renewed. HSTS then lets a returning browser skip even the redirect.\nAnything beyond those jobs on port 80 is a page served without the guarantees\nabove.\n\nLoopback is the one standing exception for ordinary sites. The specification\ncounts `localhost`, `127.0.0.1` and `::1` as potentially trustworthy, so a page\nserved from the developer's own machine gets secure-context features without a\ncertificate. That convenience for developers is the source of one of the\nfaults below.\n\n## What it looks like in practice\n\nThe company's own site follows that rule. On the production host,\n[Caddy answers every web request and renews the HTTPS certificate itself](/credits/),\nfrom Let's Encrypt, so keeping the certificate current is the web server's job\nrather than a person's. The same pages are published as a Tor onion service,\nand that address begins with `http://` on purpose. An onion address encodes the service's identity public key. Tor authenticates the service and encrypts the connection before HTTP is exchanged, which is why this mirror uses HTTP over Tor. The credits page also links Qualys\nSSL Labs, which grades the live HTTPS configuration for anyone who asks.\n\nClient work shows the secure-context rule from the other side. For a platform\nwhose users are often seafarers and field staff on phones, frequently offline,\nthe company delivered\n[full Progressive Web App support](/portfolio/delivered-full-progressive-web-app-support/),\nwith a service worker caching fonts, images, audio, video and CDN assets\ncache-first. Because service workers only really behave over HTTPS, the offline\nand install behaviour was tested over HTTPS on real devices instead of being\nassumed. The same need shows up in the tooling of\n[a polyglot monorepo with 578 task targets](/portfolio/authored-578-go-task-automation-targets/),\nwhere the go-task layer the company wrote puts an HTTPS variant for testing PWA\nand mobile next to the native and Docker development modes.\n\n## Where it goes wrong\n\n**Scripts stop running after the switch to HTTPS, and some images vanish.** The\npages still contain `http://` addresses, hard-coded in a template, stored in\nCMS content or pasted in with a third-party snippet. The browser blocks the\nscripts and stylesheets and upgrades the images, which then break wherever the\nother host has no HTTPS. The browser console names each blocked address. Search\nthe templates and the stored content for the old scheme, and rewrite each hit\nas `https://` or as a path relative to the site:\n\n```sh\ngrep -rnE '(src|href)=\"http://' templates/ content/\n```\n\nA `Content-Security-Policy: upgrade-insecure-requests` header carries the pages\nthrough the clean-up, but it leaves the stored addresses as they were.\n\n**The site redirects to itself until the browser gives up.** A CDN or load\nbalancer terminates TLS and forwards the request to the application over plain\nHTTP. The application sees `http`, redirects to `https`, the proxy forwards the\nretry as `http` again, and the loop ends in a “too many redirects” error. The\nsame blindness makes the application build absolute links that start with\n`http://`. The proxy has to pass on the original scheme, in the standard\n`Forwarded: proto=https` header from RFC 7239 or the older `X-Forwarded-Proto`,\nand the application should believe that header only when it comes from the\nproxy's own address, since any client can send it. Then let one layer own the\nredirect, normally the one that holds the certificate.\n\n**A session cookie set over HTTPS travels in the clear.** RFC 9110 warns that\ncookies do not respect the line it draws between the two origins. Under the\ncookie rules of RFC 6265, a cookie without the `Secure` attribute is sent on\nplain `http://` requests to the same host as well. A visitor typing the bare\nname is enough to send it, and so is an attacker on the network who answers any\nunrelated plain request with a redirect to the site's `http://` address. Set\n`Secure` on every cookie the site issues, and add HSTS so the browser never\nmakes the plain request in the first place.\n\n**The service worker runs on the laptop and is missing on the phone.** The\ndeveloper opens `http://localhost:3000`, a secure context, and everything works.\nThe phone on the same network opens `http://192.168.1.20:3000`, which is not\none, so `navigator.serviceWorker` is undefined, a library that checks for it\nskips registration, and offline mode is quietly absent. Serve the development\nbuild over HTTPS as well. Caddy, for one, issues certificates for local names\nand IP addresses from its own local certificate authority and tries to add that\nroot to the machine's trust store. Its documentation warns that the step is\nnot guaranteed and that getting the root into every trust store is the\nadministrator's job, and a test phone has to be given that root by hand.\n\n## Further reading\n\n- [RFC 9110, section 4.2.2: https URI Scheme](https://www.rfc-editor.org/rfc/rfc9110#name-https-uri-scheme)\n  — the scheme, its default port, and the rule that a client must check the\n  server's identity.\n- [Secure Contexts](https://www.w3.org/TR/secure-contexts/) — which pages count\n  as secure, why loopback qualifies, and the advice to restrict new features.\n- [Mixed Content](https://www.w3.org/TR/mixed-content/) — which requests from an\n  HTTPS page are upgraded and which are blocked.\n- [RFC 7239: Forwarded HTTP Extension](https://www.rfc-editor.org/rfc/rfc7239)\n  — the standard header a proxy uses to pass on the scheme the visitor used.\n- [Automatic HTTPS](https://caddyserver.com/docs/automatic-https) — Caddy's own\n  account of its certificates, its redirect from HTTP and its local certificate\n  authority.\n\n\u003chttps://engineer.company/glossary/https/\u003e\n","date_modified":"2026-11-12T05:34:23Z","description":"What HTTPS hides and what it leaves visible, why almost nothing still belongs on http://, and the faults that appear once a site moves over.","formats":{"gemtext":"https://engineer.company/glossary/https/index.gmi","gopher":"https://engineer.company/glossary/https/gophermap","html":"https://engineer.company/glossary/https/","json":"https://engineer.company/glossary/https/index.json","markdown":"https://engineer.company/glossary/https/index.md","pdf":"https://engineer.company/glossary/https/index.pdf"},"kind":"page","language":"en","title":"What is HTTPS?","url":"https://engineer.company/glossary/https/","version":1}