Session Record — 2026-02-14 10:49
Session Record — 2026-02-14 10:49
Topic: Cloudflare Caching Restoration (Continued)
What We Did
-
Resumed caching audit from a previous session that had started reviewing Django cookie/session usage for Cloudflare compatibility.
-
Found and fixed 3 blockers preventing Cloudflare edge caching on give-htmx:
- Blocker 1:
session['logoPath']write ingive/base.pyGiveContextMixin.get_base_page_context() — removed it (logoPath already passed via context, session write was redundant) - Blocker 2: DRF
DEFAULT_AUTHENTICATION_CLASSESset to[SessionAuthentication]inconfig/settings/base.py— changed to[]. Safe because all public views useAllowAny; payroll views explicitly set their own auth. - Blocker 3:
BillingCountryViewandBillingSubregionViewingive/views.pyinheritedHtmxTemplateView.dispatch()which creates sessions and setsCache-Control: no-store. Added dispatch() override to skip session creation for these static reference data views. -
All 3 fixes committed as single commit
6bd1da9concloudflare-caching-prepbranch, cherry-picked to main and qa. -
Documented 6 Cloudflare Cache Rules in
CLOUDFLARE_CACHING_RESTORATION.md: - Rule 1: Bypass cache for checkout/session paths
- Rule 2: Bypass for Django admin
- Rule 3: Bypass for API endpoints
- Rule 4: Bypass for auth/CAS paths
- Rule 5: Cache homepage and fund pages (eligible for edge cache, 2h TTL)
- Rule 6: Cache static assets (1d TTL)
-
All rules scoped to
give-qa-cf.berkeley.edufor QA testing first -
Cross-referenced URL config (
config/urls.py) against Cache Rules — found 4 missing bypass paths:/pledgefailed,/modal,/api/hepdata,/hepdata. Added to Rule 1. -
Created Playwright caching test suite at
tests/caching/cloudflare-cache-rules.spec.ts: - 10 tests for cacheable endpoints (homepage, fund pages)
- 5 tests for checkout bypass verification
- 3 tests for API bypass verification
- 1 test for basket isolation (cached pages don't leak basket state)
-
1 test for static asset caching
-
Branch management:
- Created
cloudflare-caching-prepbranch off main - Cherry-picked fixes to main, qa, and mcp-server
- Merged main into mcp-server for full sync
-
Pushed givecore docs updates (multiple commits)
-
Discovered qa branch email divergence: qa has
example.comtest emails while main has the correctoskibare1868@gmail.com. User confirmed canonical email preference — saved to memory.
Current State
- give-htmx branch:
main - Caching code fixes: On both main and qa
- Playwright caching tests: On both main and qa
- Cloudflare Cache Rules: Documented but NOT yet created in dashboard (manual step)
- givecore docs: Pushed to origin/main with full Phase 2 instructions
Remaining Work
| Phase | Status | Description |
|---|---|---|
| Phase 0/0.5 | DONE | Django code fixes for cookie/session compatibility |
| Phase 2 | READY | Create 6 Cache Rules in Cloudflare dashboard (manual) |
| Phase 1+3 | DEFERRED | give-worker settings cleanup (with BigGive work) |
| Phase 4 | NEXT | Deploy qa, create rules, run Playwright validation |
| Phase 5 | PENDING | Production rollout |
qa vs main Differences (Unresolved)
- 3 test files deleted on qa, present on main:
cybersource-amount-triggers.spec.ts,gift-verification-e2e.spec.ts, onetime-gift E2E spec - 3 checkout specs on qa have
example.comemails instead ofoskibare1868@gmail.com - Deploy configs intentionally different per branch
Key Files Modified
give-htmx/give/base.py— removed session['logoPath'] writegive-htmx/config/settings/base.py— cleared DRF auth classesgive-htmx/give/views.py— dispatch() override on 2 billing viewsgive-htmx/tests/caching/cloudflare-cache-rules.spec.ts— new Playwright test suitegivecore/docs/plans/CLOUDFLARE_CACHING_RESTORATION.md— updated with Phase 2 instructions, Playwright section