Skip to content

Defeat the Edge Cache in the Media Check and Name the Zone Settings - #496

Merged
ptr727 merged 6 commits into
developfrom
edge-proxy-followups
Oct 24, 2026
Merged

ptr727 merged 6 commits into
developfrom
edge-proxy-followups

Conversation

@ptr727

@ptr727 ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-ups to #492 from the host side's review of it on ptr727/HomeAutomation-Config#580. They land before the first release that runs its gate against a proxied hostname. The family site went proxied at 2026-10-24T01:47Z.

  • checks/check-live-urls.sh: check_media asks for each media file with a per-run ?live-check=<epoch>-<pid> query, on the first request and on the legacy /wp-content/uploads/ hop, whose redirect drops the query. Cloudflare's default cache key includes the query string, so an edge copy cannot answer for a file a release lost. The host side measured that CrowdSec strips the query before classing a path static, so the production crawl budget is unchanged.
  • checks/tests/test_check_live_urls_sample.py: a full run asks for every media path, the hop included, with one token per run, and two runs use different tokens. The mock drops the query on the legacy redirect, as Caddy does.
  • deploy/Caddyfile: the blog's error page is served from its precompressed siblings, as every other page is.
  • deploy/README.md: "Cache lifetimes" names the two zone settings the lifetimes depend on. Browser Cache TTL must be "Respect Existing Headers", since a new zone's 4-hour default replaces any shorter origin lifetime. Caching Level must not be "Ignore Query String", which would defeat the media query. The section is one paragraph per line, which also answers the Copilot note on Promote the Edge Proxy Cache Lifetimes #494. "Trusting the proxy" says client_ip is client-chosen behind Cloudflare.
  • OPERATIONS.md: Cloudflare caches robots.txt by default, and its no-cache answer keeps it from being stored. Behind Cloudflare, client_ip is whatever the client wrote, so read the last element of ClientHost instead.

no-transform on the page classes was proposed too, and left out. Its effect on compression for a client that does not accept Brotli is undocumented, and #495 tracks measuring it.

Verification

  • Released the branch to the local staging mirror three times. check-live-urls.sh passed 1294 URLs each time. The last release serves pages and the 404 page with no-cache and content-encoding: br.
  • Checked each Cloudflare claim against its docs: the default cache key, the caching levels, the Browser Cache TTL default and override, and robots.txt default caching.
  • python3 -m unittest discover -s checks/tests passed 128 tests. The new test fails without the hop's own query.
  • shellcheck, shfmt, ruff, and markdownlint report nothing. prose_lint.py --diff reports only the comments findings this PR's label answers, and --check sentence-length reports nothing.
  • Local strict review: four passes ran. The first raised three findings and the second raised two, all fixed. The third raised the no-transform compression question, and the maintainer chose to drop the directive. The fourth, over the final content, found nothing.

Pre-existing findings, not filed

  • OPERATIONS.md:310, pre-existing: the reason given against a query-parameter check tag says a query pollutes the path. checks/log-review.jq already drops the query from the key, so only the ?p= collision half of that reason holds.

🤖 Generated with Claude Code

ptr727 and others added 5 commits October 23, 2026 18:42
The live check asks for each media file with a per-run query, on the
first request and on the legacy hop, so an edge copy cannot answer for
a file a release lost. Page classes gain no-transform, which opts the
bundle out of Cloudflare's content rewrites whatever the zone enables.
deploy/README.md names the Browser Cache TTL and Caching Level the
lifetimes depend on, and OPERATIONS.md corrects the robots.txt default
and says client_ip is client-chosen behind Cloudflare.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 24, 2026
Copilot AI lite review requested due to automatic review settings October 24, 2026 02:42
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: c8aad03c-c532-41ca-ae54-953fa949e055
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head f31c0c5f4150dddc1bb250fd8854fcbe34100688, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.70%. Comparing base (070b7ab) to head (61ded16).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #496   +/-   ##
========================================
  Coverage    49.70%   49.70%           
========================================
  Files           10       10           
  Lines         3058     3058           
========================================
  Hits          1520     1520           
  Misses        1538     1538           
Flag Coverage Δ
python-3.13 49.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Address the no-cache wording and Markdown link-style findings before approval.

No open issues 🎉

What changed in this PR

This pull request prepares the media validation gate and deployment guidance for operation behind Cloudflare, while serving compressed error pages consistently.

Changes:

  • Adds per-run cache-busting queries to media checks, including legacy redirect hops, with regression coverage.
  • Documents Cloudflare cache-zone settings and proxied client-IP handling.
  • Enables precompressed Brotli and gzip serving for the blog error page.
File Reviewed changes
OPERATIONS.md Documents Cloudflare caching and client-address handling. [P2] The no-cache guidance should describe revalidation rather than implying that responses cannot be stored at the edge (1 vote; moderate).
deploy/​README.md Names the required Browser Cache TTL and Caching Level settings and documents proxy behavior. The new OPERATIONS.md link should follow the repository’s reference-style link convention (1 vote; nit).
deploy/​Caddyfile Serves the blog error page through precompressed siblings.
checks/​tests/​test_check_live_urls_sample.py Verifies unique per-run media query tokens and query handling across redirect hops.
checks/​check-live-urls.sh Adds per-run cache-busting queries to media checks and legacy media destinations.

Review effort: Lite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 61ded162576600c6f5d0ce5c0a1617ca3f6acdea, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Answering the two findings the review on f31c0c5 names in its file table, both fixed in 61ded16.

  • OPERATIONS.md, no-cache guidance (P2): real, fixed. The robots.txt sentence now says its no-cache answer has any copy revalidated before use, which matches the README table, rather than saying the answer keeps it from being stored.
  • deploy/README.md, reference-style links (nit): real, fixed as a class. Every link in the file was inline, the new one included. All of them are now reference-style, with one <!-- Repo --> definition block at the end, alphabetized by name. One sentence on an edited line was split to stay within the sentence-length rule.

A local strict review pass over 61ded16 found nothing.

@ptr727
ptr727 merged commit f35ec08 into develop Oct 24, 2026
12 checks passed
@ptr727
ptr727 deleted the edge-proxy-followups branch October 24, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants