Skip to main content
Convertly’s image CDN is designed for long-lived edge cache and deterministic URLs. This guide covers performance best practices and fixing origin fetch failures.

Cache keys and immutability

Every CDN URL is a contract:
https://cdn.convertly.sh/{namespace}/{fileId}?w=1200&format=auto&gravity=smart
The edge cache key includes path + query params + Accept + Save-Data + Client Hints when used. That means:
  • Changing w, format, or any transform param creates a new cache entry (by design).
  • Reusing the same URL always hits the same bytes — ideal for Cache-Control: immutable semantics.
  • Do not overwrite files in place if you need instant updates; upload a new fileId or purge.

Prefer new file IDs over in-place overwrites

PatternCache behaviour
Upload v2 as new file, update HTMLOld URL keeps serving v1; new URL is fresh
Overwrite bytes at same file IDEdge may serve stale bytes until TTL or purge
Purge asset:{fileId} tagInvalidates all transform variants for that file

Format negotiation

Use format=auto (SDK default) so modern browsers get AVIF/WebP and legacy clients get JPEG from one URL string. Convertly sets Vary: Accept — at most two encoded variants per transform URL. See Format & delivery.

Responsive delivery

  • Most sites: <ConvertlyImage> or srcset + sizes — see Responsive images.
  • Fluid layouts: ch=Width,Dpr — see Client Hints guide.
  • Art direction: <picture> with different w/h/gravity per breakpoint.
Include widths up to ~2× your layout size (or use dpr=2 with a fixed w — see Device pixel ratio).

Presets reduce mistakes

Named presets (hero, thumb, og-card) keep param sets consistent across teams and reduce accidental cache fragmentation from typos.

Purge strategy

ScenarioRecommendation
Single known URL changedPurge by URL
File replaced in storage, many widths livePurge by tag asset:{fileId}
Redeployed entire origin folderorigin:{slug} tag purge
Routine content updatesNew file ID — skip purge

Origin deliverability

Convertly fetches origin-backed URLs (/o/{slug}/…) over public HTTPS or private bucket credentials. If transforms fail or return errors, check the following.

Public HTTPS origins

CheckWhy it matters
URL returns 200 in a private browser tabCDN must fetch without cookies
HTTPS with valid certificateHTTP and self-signed are rejected
Not localhost / 127.0.0.1 / RFC1918 IPsPublic CDN cannot reach your laptop
Correct Content-Type (image/jpeg, etc.)Wrong MIME can break encode pipeline
No hotlink blocking that blocks Convertly’s fetcherSome WAF rules block unknown user agents
Response under size limitsVery large originals slow first transform
Local dev: use Next.js localPassthrough or point the origin at a preview deploy or HTTPS tunnel — see Image CDN setup and Operations → Local development.

Private bucket origins (S3, R2, GCS, Azure)

CheckWhy it matters
Read credentials are valid and not expiredConvertly decrypts stored creds server-side only
Bucket + path prefix match the object keypathPrefix is prepended to every fetch
IAM / policy allows GetObject on the prefixWrite access is not required
Region / endpoint matches providerR2 and custom S3 endpoints need explicit endpoint
Examples for R2, GCS, and Azure.

Common error patterns

SymptomLikely cause
403 on CDN URL, JSON body about signed URLNamespace is signed/private — add ?s= via signing API
502 / upstream fetch failedOrigin URL 404, timeout, or credentials rejected
Image never updates after deployBrowser + CDN cache; bump file id or purge
Works in prod, not locallyExpected — use passthrough or public preview origin

Smart crop cost

gravity=smart and gravity=face run analysis on cache miss only. Popular URLs pay once, then serve from edge indefinitely. For zero per-request analysis, persist focal points from POST /api/images/analyze and render with fp=x,y.

Security vs performance

  • public namespaces: fastest path — embed URLs directly in HTML.
  • signed / private namespaces: every URL needs server-side signing — plan for sign API latency at render time, not per browser request if you cache signed URLs until exp.
See Delivery access modes.