Ugrás a fő tartalomra
← 📄 HTML & the platform·Modul A7 · Lecke 11
FeladatBuild a minimal HTML page that the server can compress: doctype, html, head with charset + title 'Compressed', body with three paragraphs of placeholder text.

Tömörítés: gzip, brotli, amit a szervernek küldenie kell

75 XP6 min
Elmélet

You're not setting this in HTML — but you need to know it exists

Compression happens at the HTTP layer. The server compresses, the browser decompresses, you never see it in your code. But it's THE most important "free" performance win:

  • gzip — 1992-era, widely supported. ~70% smaller than uncompressed text.
  • brotli (br) — 2013, faster + smaller than gzip. ~80% smaller than uncompressed. All modern browsers support it.

Your stack should serve Content-Encoding: br for any text response > 1KB.

How to verify

Open DevTools → Network → look at any .html / .css / .js request → "Response Headers" tab. Look for content-encoding: br (or gzip).

If you see no content-encoding header on a text response, your server isn't compressing. That's a 4x bandwidth waste.

Defaults by host

  • Vercel — brotli on, automatic.
  • Cloudflare — brotli on, automatic.
  • Netlify — brotli on, automatic.
  • Custom Nginx — you need to install ngx_brotli module + configure (gzip is built-in).
  • Apache — mod_deflate for gzip; brotli requires mod_brotli.

What NOT to compress

  • Images (.jpg, .png, .webp) — already compressed at the file level.
  • Fonts (.woff2) — already compressed.
  • Video — already compressed.

Compressing the un-compressible WASTES CPU. Configure your server to skip these MIME types.

🔒

Regisztrálj, hogy elkezdj programozni

Az elmélet mindenkinek nyitva. A szerkesztő, élő előnézet és ellenőrzés 7 napos ingyenes próbával nyílik meg — kártya szükséges, bármikor lemondható.

Regisztráció — ingyenes próba →

Minden útvonal első 10 leckéje ingyenes. Nem kell kártya.

← ElőzőKövetkező lecke →

Egy Python- vagy webes tipp naponta — emailben

Rövid, kézzel írt, spam nélkül. Egy kattintással leiratkozhatsz.