mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 05:35:30 +02:00
[GH-ISSUE #1169] [Bug]: gcode viewer broken behind reverse proxy: trailing-slash 404 + restrictive CSP #845
Labels
No labels
A1
automated
automated
bug
bug
Closed due to inactivity
contrib
dependencies
dependencies
duplicate
enhancement
feedback
hold
invalid
Notes
P1S
pull-request
security
security
ThumbsUp
user-report
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/bambuddy#845
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Originally created by @penmoid on GitHub (Apr 29, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/1169
Originally assigned to: @maziggy on GitHub.
Component
Bambuddy
Bug Description
Three issues block the gcode viewer (and the broader Bambuddy UI) when running Bambuddy behind a TLS-terminating reverse proxy. All are server-side / packaging defaults — not configuration the operator can fix without rewriting headers in front of Bambuddy.
1.
/gcode-viewer/(trailing slash) returns 404The frontend renders the gcode-viewer iframe with
src=\"/gcode-viewer/?archive=...&plate=...\"(trailing slash), but the FastAPI backend only registers the route without a trailing slash:Result: opening the gcode viewer from the printer detail page just shows "Not Found." Either the route should be registered with both forms, or FastAPI should be configured with
redirect_slashes=True(it's True by default unless explicitly disabled).2. Default CSP
connect-srcis missinghttps://fonts.gstatic.comThe shipped
Content-Security-Policyheader includes:But the service worker (
sw.js) fetches Inter.woff2files viafetch(), which is governed byconnect-srcrather thanfont-src. Result, repeated on every page load:Fix: add
https://fonts.gstatic.comtoconnect-src(and confirmhttps://fonts.googleapis.comis there too — needed when the SW prefetches the CSS).3. Default CSP
child-src 'none'blocks the gcode viewer iframeEven after fixing #1, the iframe still won't render:
Since the gcode viewer is served from the same origin,
child-src 'self'(orframe-src 'self') is required for a feature shipped with the product to actually work.Expected Behavior
Out of the box behind a reverse proxy:
/gcode-viewer/(with or without trailing slash) returns the SPA so the iframe loads.connect-srcshould includehttps://fonts.gstatic.com(andhttps://fonts.googleapis.com), andchild-src/frame-srcshould allow'self'so the gcode viewer iframe renders.Steps to Reproduce
ghcr.io/maziggy/bambuddy:dailybehind a reverse proxy that terminates TLS (in my case Traefik on Kubernetes; same behavior reproduces on any TLS-terminating proxy).connect-srcviolations forfonts.gstatic.comlog on every page load.child-src 'none'violation.Workarounds applied externally (Traefik middleware)
For anyone hitting this, the issue can be worked around without modifying the image:
redirectRegexmiddleware that rewrites^https?://([^/]+)/gcode-viewer/(\?.*)?$→https://${1}/gcode-viewer${2}.https://fonts.gstatic.comtoconnect-srcand setschild-src 'self'; frame-src 'self';.httpsOrigins when the upstream sees plain HTTP. Worth noting Bambuddy is sensitive to this — operators must injectX-Forwarded-Proto: httpsin front of Bambuddy or the live status WS won't connect. (See also #1096 for the spoolman variant.)Bambuddy Version
ghcr.io/maziggy/bambuddy:daily@sha256:f68e024e88f00159c50e6a155c24d80652bcb63e0b7e82b36ca7f1fdfd386c73(pulled 2026-04-29)Printer Model
H2C / A1 Mini (not printer-specific — reproduces on the web UI itself)
@penmoid commented on GitHub (Apr 29, 2026):
Closing — filed in error. Will re-open if/when intended.