Repository navigation
Name a Cache Lifetime on Every Response Ahead of an Edge Proxy - #492
Conversation
A proxy that caches by file extension sits in front of neither site today, and nothing in the bundle says how long a copy may live, so a browser guesses from Last-Modified and an edge would apply its own defaults. Every blog response now carries a Cache-Control: pages and feeds revalidate on every use, the fingerprinted assets are immutable, and media is bounded to an hour so a replaced image propagates without a purge. Both error pages answer no-cache whatever path they stand in for, and the family pages state the same. The log review keeps the last element of ClientHost, since a proxied request carries the forwarded chain there and a client may prepend any value. The operations doc names the edge as a tier above Traefik and what it hides. Verified on the local staging mirror: the live check passes, and each class serves the header the deploy README's table states.
The first strict review pass found the deploy README claiming a lifetime on every blog response while the redirects carry none, the operations doc and the jq comment using the edge for Cloudflare where that section means Traefik, the forwarded-chain claim missing the trust condition it depends on, and null guards on a field Traefik always writes.
The second strict review pass found two sentences over the length rule and a claim that the family block has a default header where the catch-all matcher is what reaches its redirects.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #492 +/- ##
========================================
Coverage 49.70% 49.70%
========================================
Files 10 10
Lines 3058 3058
========================================
Hits 1520 1520
Misses 1538 1538
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
Redirect responses still lack an explicit cache policy, leaving stale migration targets insufficiently bounded.
1 open issue
What changed in this PR
This pull request prepares the blog and family sites for operation behind a Cloudflare edge proxy by defining cache lifetimes, documenting proxy behavior, and normalizing forwarded client addresses in log analysis.
Changes:
- Adds explicit cache policies for assets, media, pages, family content, and error responses.
- Documents Cloudflare’s caching and request-visibility effects.
- Updates log analysis to use the final address in forwarded client chains.
| File | Reviewed changes |
|---|---|
OPERATIONS.md |
Documents Cloudflare proxy behavior and forwarded-address handling for 403 analysis. |
deploy/README.md |
Defines cache-lifetime classes and their operational rationale. |
deploy/Caddyfile |
Adds cache headers for blog, family, and error responses; redirects still require an explicit cache policy. |
checks/log-review.jq |
Extracts the final address from forwarded client chains. |
Review effort: Lite
|
A recorded local strict-review pass covers head |
Copilot found that the redirect handlers end the route before the baseline no-cache header ran, so a 301 carried no lifetime and a changed map target could outlive a deploy in a cache. The baseline now runs first and the file classes override it. Verified on the local staging mirror: the live check passes, a legacy media redirect and a feed redirect answer no-cache, and the media and error classes keep their headers.
|
A recorded local strict-review pass covers head |

Summary
Prepares the bundle for a Cloudflare proxy in front of either site, so the sites behave the same whether or not the proxy is on. The host side tracks the proxy itself as ptr727/HomeAutomation-Config#580, and this is the Blog half of what that issue lists.
deploy/Caddyfile: every blog response names its ownCache-Control. Pages, feeds, the sitemap,index.json, androbots.txtanswerno-cache, so a browser or an edge revalidates them and a deploy shows at once. The fingerprinted/assets/are immutable for a year./media/and the root icons get an hour, which bounds how long a replaced image is still served from any copy without a purge step. The redirects answerno-cachetoo, since the baseline header runs ahead of them, so a changed map target is followed at the next request. Both error pages answerno-cachewhatever path they stand in for, since a missing file in a cached class would otherwise keep that class's lifetime. The family pages stateno-cacheexplicitly, beside the@svgand@codelifetimes the block already set.checks/log-review.jq: keeps the last element ofClientHost. Traefik writes the whole forwarded header there when a trusted proxy sends one, and Cloudflare appends the address it saw to any chain the client sent, so the last element is the one to read and the first is client-controlled. A record with no chain is unchanged. Traefik writes the field on every line, so it carries no null guard.OPERATIONS.md: names the edge as a tier above Traefik that keeps no readable record, what still reaches Traefik (every HTML, XML, JSON, and text404), what becomes a floor (counts on cached file types), and why the403cross-check reads the last forwarded address.deploy/README.md: a "Cache lifetimes" section with the class table.Verification
check-live-urls.shpassed 1294 URLs each time, with the rules from the new release.feed.xml, androbots.txtanswerno-cache, the stylesheet answerspublic, max-age=31536000, immutable, a media file andfavicon.icoanswerpublic, max-age=3600, a missing/media/image and a missing page answer404withno-cache, a legacy/wp-content/uploads/path and a feed alias answer301withno-cache, and the family root,/en/,/af/, and a missing path answerno-cachewhilecrest.svgkeeps its week.checks/log-review.jqover constructed records: a two-element chain keeps its last element, and a single address is unchanged.python3 -m unittest discover -s checks/testspassed 127 tests.prose_lint.py --diffreports only thecommentsfindings this PR's label answers, and--check sentence-lengthreports nothing. markdownlint reports nothing on the two edited Markdown files.🤖 Generated with Claude Code