**Priority:** High (Final sprint before 27 Nov) **Source:** Peer feedback + pre-submission sustainability/security audit + live NTNU VM check ## Problem 1. **Oversized hero image & tall mobile hero (`client/src/assets/vinyl-hero.webp`, `App.tsx:82-101`, `App.css:82-98,186-211`, `SearchForm.css:59-67`, `docs/lighthouse-results.md:27`):** - `vinyl-hero.webp` is **449.9 KB** (1800×2700 portrait) — larger than all initial gzipped JS + CSS + Latin fonts combined — and loads via CSS `::before` with no mobile variant or preload, driving 4.5 s mobile LCP (cited by 4 peer reviewers). - On mobile (`<= 700px`), hero padding/typography pushes `#catalogue` well below the fold (cited by 3 reviewers). 2. **Missing GraphQL compression, `Cache-Control`, and HTTP security/referrer headers (`docs/VM-setup.md:11-18,52-108`, `client/index.html:1-13`, `client/src/components/AlbumCover.tsx:29-45`):** - Live NTNU VM verification (`it2810-19`, Ubuntu 26.04.1, `Apache/2.4.66`) confirmed: - Enabled modules: `deflate_module`, `headers_module`, `proxy_module`, `proxy_http_module` (`expires_module` and `brotli_module` are **not** enabled). - Static HTML/JS are already gzipped, but `POST /graphql` (`application/json`) is **not** compressed. - No `Cache-Control` headers exist on content-hashed `/project2/assets/*` or `/project2/index.html`. - No HTTP security headers (`Content-Security-Policy`, `X-Content-Type-Options`, `X-Frame-Options`, `Referrer-Policy`) are configured, and `AlbumCover.tsx` loads external Cover Art Archive images without `referrerPolicy="no-referrer"`. - `docs/VM-setup.md` also omits `NODE_ENV=production` for `crate-api.service` (needed for #129) and `chmod 600 ~/T19-Project-2/.env` setup guidance (already `0600` on the live VM, should be documented for fresh setups). ## Suggested solution - Crop/re-encode `vinyl-hero.webp` into landscape desktop (`~1280px`, `< 80 KB`) and mobile (`~640px`, `< 35 KB`) WebP variants; render with responsive `<img srcSet sizes fetchPriority="high">` (or CSS `image-set` + `<link rel="preload">`). - Tighten mobile hero spacing/height (and/or add a compact jump link to `#catalogue`) so results are reachable with minimal scrolling on a 390×844 viewport. - Add `referrerPolicy="no-referrer"` to `AlbumCover.tsx:29-45` and `<meta name="referrer" content="no-referrer" />` to `client/index.html`. - Update `docs/VM-setup.md` and apply on the NTNU VM using the already-enabled `mod_deflate` and `mod_headers` (no `mod_expires`/`mod_brotli` required): - `AddOutputFilterByType DEFLATE application/json` for proxied `/graphql` responses. - `Header set Cache-Control "public, max-age=31536000, immutable"` on `/project2/assets/*` and `no-cache` on `index.html`. - Security headers: `X-Content-Type-Options: nosniff`, `X-Frame-Options: DENY`, `Referrer-Policy: no-referrer`, and baseline `Content-Security-Policy` allowing `'self'` plus `https://coverartarchive.org` / `https://*.archive.org` for `img-src` (coordinated with #132's theme script so no `unsafe-inline` is needed). - Document `NODE_ENV=production` in `crate-api.service`, `chmod 600 ~/T19-Project-2/.env`, and a `curl -I` / `Accept-Encoding: gzip` verification step. ## Acceptance criteria - [ ] Hero image assets are optimized to landscape desktop (`< 80 KB`) and mobile (`< 35 KB`) WebP variants with responsive loading and high-priority preload/fetch, measurably reducing mobile LCP. - [ ] Mobile hero height/spacing is tightened (and/or includes a quick jump to `#catalogue`) so catalog results are quickly accessible on mobile viewports. - [ ] `AlbumCover` sets `referrerPolicy="no-referrer"` and `client/index.html` sets `<meta name="referrer" content="no-referrer" />`. - [ ] Apache configuration in `docs/VM-setup.md` (and applied on the VM) compresses `/graphql` `application/json` via `mod_deflate`, sets `Cache-Control` via `mod_headers` for `/project2/assets/*` and `index.html`, and sets `X-Content-Type-Options`, `X-Frame-Options`, `Referrer-Policy`, and baseline `Content-Security-Policy` without breaking the app or #132's theme toggle. - [ ] `docs/VM-setup.md` documents `NODE_ENV=production` for `crate-api.service`, `chmod 600 ~/T19-Project-2/.env`, and `curl -I` verification commands.