fix: Varnish VCL no longer crashes with multiple projects (v1.18.3)#131
Open
jakwinkler wants to merge 1 commit into
Open
fix: Varnish VCL no longer crashes with multiple projects (v1.18.3)#131jakwinkler wants to merge 1 commit into
jakwinkler wants to merge 1 commit into
Conversation
buildVCLConfig emitted one backend per project but the template only referenced DefaultBackend, so Varnish 7.x aborted on the first unused backend and crash-looped (502). The probe also used HEAD / expecting 301 while Magento returns 302 (503). Emit a single 'magento' backend (Nginx routes per project by Host) and probe GET /health_check.php expecting 200. Fixes both the embedded template (internal/varnish/templates) and the lib copy. Supersedes #127 (which patched only the unused lib template). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #127 — that PR patched the probe only in
lib/templates/varnish/default.vcl.tmpl, but the template actually rendered at runtime is the//go:embed-edinternal/varnish/templates/default.vcl.tmpl, so the probe stayed broken. This PR fixes both copies and is rebased on currentmain(v1.18.2).What's wrong
With 2+ registered projects the shared
magebox-varnishcontainer crash-loops → 502 / 503:buildVCLConfigemitted onebackendper project, but the template only ever referencesDefaultBackend(set req.backend_hint = {{.DefaultBackend}}). Varnish 7.x treats a defined-but-unused backend as a fatal error (Unused backend <name>) → VCL won't compile → crash-loop → 502. Every backend was identical (host.docker.internal:8080) anyway; Nginx already routes per project byHost.HEAD /expecting301; Magento returns302→ backendsick→ 503.BackendConfig.ProbeURL(/health_check.php) was ignored.Recurs on every
magebox start/ restart.Fix
buildVCLConfig→ a singlemagentobackend, always.internal/varnish/templates/andlib/templates/varnish/) probeGET /health_check.phpexpecting200.sanitizeNamehelper + its test, and the comment-onlyrangeblock invcl_recv.VERSION→ 1.18.3, CHANGELOG updated.go test ./...green,go vetclean.🤖 Generated with Claude Code