Fix stale renders and bind to 0.0.0.0 for reverse proxy #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/mdview-cache-and-bind"
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
Cache-Control: no-storeand Turbono-cachemeta tag to prevent browser from showing stale content after re-running mdview0.0.0.0so k8s nginx reverse proxy can reach archbox via Tailscale IPdocs/architecture.mdwith mermaid diagrams covering the full network topologyChanges
app/controllers/markdown_controller.rb: addCache-Control: no-storeresponse headerapp/views/layouts/application.html.erb: add<meta name="turbo-cache-control" content="no-cache">bin/mdview: add-b 0.0.0.0torails servercommanddocs/architecture.md: new doc covering local CLI, k8s reverse proxy, Tailscale Funnel, single-instance model, and file resolutionTest Plan
curl -sI localhost:3137returnsCache-Control: no-store<meta name="turbo-cache-control" content="no-cache">ss -tlnpshows puma bound to0.0.0.0:3137wgetfrom inside the podReview Checklist
Related Notes
ldraney/pal-e-deployments #185-- companion fix for k8s overlayPR #15 Review
DOMAIN REVIEW
Tech stack: Ruby on Rails 8.1, Puma, Turbo Drive, Bash shell script, Mermaid documentation.
Rails / Cache-Control
The
Cache-Control: no-storeheader inmarkdown_controller.rb(line 10) is the correct directive for this use case.no-storetells the browser to never cache the response at all, which is exactly what is needed when the same URL can serve different files after a server restart. This is stronger thanno-cache(which still stores but revalidates), and appropriate here since there is no performance cost -- this is a local dev tool, not a high-traffic service.The
<meta name="turbo-cache-control" content="no-cache">inapplication.html.erb(line 6) correctly tells Turbo Drive not to serve cached snapshots when navigating. This is the Turbo-specific complement to the HTTP header -- both are needed because Turbo maintains its own in-memory page cache independent of the browser HTTP cache.Puma bind address
The
-b 0.0.0.0flag inbin/mdview(line 32) is consistent withconfig/puma.rb(line 31) which already hasbind "tcp://0.0.0.0:#{ENV.fetch("PORT", 3137)}". The CLI flag and the puma config are now aligned. Previously the CLI was not passing-b, so puma would bind per its config file -- the explicit flag is redundant but harmless, and makes the intent visible in the script. No conflict.Security consideration -- binding to 0.0.0.0: This is a local developer tool on a Tailscale-connected machine, not a public-facing service. The path traversal guard in
resolve_file(line 34) properly constrains file access to thebase_dirsubtree. Theconfig.hostsallowlist indevelopment.rb(line 52) restricts which Host headers are accepted. Acceptable for this use case.Documentation
docs/architecture.mdis well-structured with accurate Mermaid diagrams. One minor factual note: the sequence diagram on line 53 showsexec bin/rails server -p 3137without the-b 0.0.0.0flag that this PR adds. The actual command after this PR isexec bin/rails server -b 0.0.0.0 -p "$PORT". This is a documentation drift within the same PR.The Tailscale IP
100.110.151.59appears in the architecture doc (lines 25, 65). This is a Tailscale CGNAT address (100.64.0.0/10 range), not a public IP, so it is not a security exposure. It is a hardcoded value that will break if the machine's Tailscale IP changes, but that is a property of the deployment overlay, not this repo.BLOCKERS
None.
The project has no test directory (
test/orspec/does not exist). This is a local developer tool (markdown viewer CLI) with no existing test infrastructure. The changes are a 1-line HTTP header, a 1-line meta tag, and a 1-line CLI flag -- all configuration-level changes, not new functionality requiring unit tests. The BLOCKER criterion for "new functionality with zero test coverage" does not apply to pure configuration changes in a project with no test harness.No secrets, credentials, or unvalidated user input introduced. No DRY violations. No auth/security path changes.
NITS
Sequence diagram drift --
docs/architecture.mdline 53 showsexec bin/rails server -p 3137but the actual command after this PR isexec bin/rails server -b 0.0.0.0 -p "$PORT". Consider updating the diagram to match.Redundant bind flag --
bin/mdviewpasses-b 0.0.0.0on the command line, andconfig/puma.rbalready hasbind "tcp://0.0.0.0:...". Both work, but the duplication means a future change to the bind address requires updating two places. Consider removing one. The puma config is the canonical location for Rails apps; the CLI flag makes the intent visible in the script. Either approach is fine, but pick one source of truth.SOP COMPLIANCE
fix/mdview-cache-and-bind, not14-fix-stale-rendersor similar{issue-number}-{kebab-case}convention. Minor deviation.PROCESS OBSERVATIONS
pal-e-deployments #185).docs/architecture.mdwith accurate Mermaid diagrams for a project that had none is a positive investment. Fix the sequence diagram nit to avoid immediate drift.VERDICT: APPROVED
Clean, minimal, well-scoped changes. The cache-busting approach is correct for the single-instance restart model. No blockers. The sequence diagram nit and branch naming deviation are non-blocking.