fix: add Caddy proxy to InvenTree for static file serving - #88
Merged
Merged
Conversation
InvenTree's Django server does not serve static files in production mode — it requires a separate file server (Caddy/nginx) for /static/ and /media/. Without it, the SPA shell loads but JS assets 302 redirect to the Django server which can't serve them, causing INVE-E1 error. Changes: - Add inventree-proxy service (caddy:alpine) as isMain on port 80 - Move isMain/internalPort off inventree-server (now internal-only) - Caddy proxies API requests to inventree-server:8000 - Caddy serves /static/ and /media/ from the shared data volume - Include Caddyfile in data/ directory - Bump tipi_version to 2, port to 80 Verified: login page renders correctly, JS assets load, API auth works.
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.
Problem
InvenTree's Django server does not serve static files in production mode. Without a file server (Caddy/nginx), the SPA shell loads but JS/CSS assets return 302 redirects to Django, which can't serve them — resulting in the INVE-E1 error page.
Fix
inventree-proxyservice (caddy:alpine) asisMainon port 80/static/and/media/from the shared data volumeinventree-server:8000isMain/internalPortoff the server (now internal-only)data/directoryTest plan
bun testpasses (126/126)curl -u admin:*** /api/user/me/returns admin user