fix(docker): enable uvicorn proxy-headers so CSS loads behind Traefik #35
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/proxy-headers"
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
The first production deploy rendered unstyled — CSS and brand images
missing. Root cause:
docker/entrypoint.shlaunches uvicorn without--proxy-headers, so Starlette ignoresX-Forwarded-ProtofromTraefik and falls back to the internal scheme/host when building
URLs via
url_for(). Templates therefore emit e.g.<link rel="stylesheet" href="http://<internal>/static/app.css">,which the browser blocks as mixed content on the
https://page.Fix: add
--proxy-headers --forwarded-allow-ips='*'to the uvicorninvocation in the entrypoint. Safe to trust all forwarded IPs because
compose.ymlpublishes no host port — only containers onproxy-net(Traefik) can reach port 8000.
Reproduction
Against the pre-fix image:
Against the rebuilt image with the fix:
Test plan
https://quartermaster.unbiasedgeek.com/static/…when Traefik-style headers are present.
/healthzstill returns 200 and JSON logs still stream.