Faster Avatar Loads with CDN Preconnect Hints
Faster Avatar Loads with CDN Preconnect Hints
Release: v1.0.90 · PERF-08
Overview
BlockManOS v1.0.90 introduces preconnect and dns-prefetch resource hints for the three external CDN domains that serve user avatar images. This is a pure performance improvement with no functional behaviour changes.
Background
Authenticated users see a nav-bar avatar on every page load. Those avatars are served from external CDN domains depending on which OAuth provider the user signed in with:
| Provider | Domain |
|---|---|
| Google OAuth | lh3.googleusercontent.com |
| GitHub OAuth | avatars.githubusercontent.com |
| Gravatar (fallback) | www.gravatar.com |
Prior to this release, the root layout included no connection pre-warming hints for these domains. On first load, the browser had to perform a full DNS lookup → TCP handshake → TLS negotiation before a single byte of avatar data could be fetched. Because avatars are positioned above the fold, this delay is directly user-visible.
What Changed
The root layout (src/app/layout.tsx) now includes an explicit <head> block with both preconnect and dns-prefetch hints for all three domains:
<!-- Google OAuth avatars -->
<link rel="preconnect" href="https://lh3.googleusercontent.com" />
<link rel="dns-prefetch" href="https://lh3.googleusercontent.com" />
<!-- GitHub OAuth avatars -->
<link rel="preconnect" href="https://avatars.githubusercontent.com" />
<link rel="dns-prefetch" href="https://avatars.githubusercontent.com" />
<!-- Gravatar fallback avatars -->
<link rel="preconnect" href="https://www.gravatar.com" />
<link rel="dns-prefetch" href="https://www.gravatar.com" />
Why both preconnect and dns-prefetch?
preconnect— Instructs the browser to perform the DNS lookup, TCP handshake, and TLS negotiation as early as possible, before any request for that domain is made. Supported by all modern browsers.dns-prefetch— A lighter fallback that resolves DNS only (no TCP/TLS pre-warm). Used by older browsers that do not supportpreconnect.
Including both ensures the widest browser coverage for the optimisation.
Expected Impact
| Metric | Before | After |
|---|---|---|
| First avatar connection overhead | ~150–300 ms (cold) | ~0 ms (pre-warmed) |
| Affects | All authenticated page loads | — |
| Scope | Above-the-fold nav-bar avatar | — |
The improvement is most noticeable on first load and after periods where the connection to the CDN has gone cold (e.g. a user returning to a tab after several minutes).
Other Changes in this Release
- The
/api/healthroute handler was updated to beasyncin line with Next.js route handler conventions. This is a housekeeping change with no observable effect on the health endpoint's behaviour or response.
Upgrade Notes
- No migrations required.
- No new environment variables required.
- No breaking changes.
This release is a drop-in upgrade.