Serve resized images without redirects #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "codex/direct-public-image-response"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Serve resize-only requests for original images directly from the existing derivative
FileResponse. The response keeps the same public immutable cache headers, ETag, content type, and HEAD behavior. Existing derivative filenames and video resize redirects remain unchanged.Root cause
The deployed
0.0.72image redirects/file/{filename}?w=...to the cached derivative filename with HTTP 307 andCache-Control: no-store. The redirect is generated by Dropper in_get_file_response; Cloudflare reportsBYPASSfor that response. The derivative path returns HTTP 200 with the existing one-year public cache policy and was observed as a Cloudflare HIT. The homelab manifest pins three replicas ofregistry.wayl.one/dropper:0.0.72, shared/data, per-pod/cache, MinIO storage, and a 120-request image transform limit.Why direct response
A stable derivative URL requires consumers to learn or construct derivative names. An edge rewrite would require Cloudflare configuration and would still need a cacheable origin response for the query URL. Direct response preserves current consumer URLs and allows Cloudflare to cache the requested URL after its first miss. It uses the existing derivative and response path; it does not add image work per cache hit.
Validation
uv run pytest -q: passed.uv run ruff check dropper: passed.uv run ruff format --check dropper/api/routes.py tests/test_hardening.py tests/test_upload_response_formats.py: passed.Rollout and rollback
After review, build and test a candidate image in Dropper dev and verify a public
GETandHEADresize request return one200with a cacheable response. Confirm warm query URLs report Cloudflare HIT and that private/auth support files remain inaccessible. Promote the image by the normal homelab GitOps review only after approval. Roll back by restoring the prior image pin; no storage migration or derivative cleanup is required.Production GitOps pins and workloads are unchanged by this PR.
ETagis present on the direct response. Starlette currently returns 200 with the body for a matchingIf-None-Match; that pre-existing validator behavior was not changed. Long-lived edge caching is expected to avoid routine conditional origin requests.