Repository navigation
Allow custom-admin host in Astro dev server - #4856
Merged
Merged
Conversation
In local dev, /admin/login/ fails with a 500 because Django fetches its admin base template from the Astro dev server at http://custom-admin:3002 and Vite answers 403 for that hostname. The check came in with the Astro ^5.0.5 to ^7.4.4 upgrade in #4841, which moved Vite from 6.0.3 to 8.3.5. Django connects using the Docker service name, so that hostname has to be allowed. Only local dev is affected, because astro_proxy returns 404 when DEBUG is off.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
EdAbati
marked this pull request as ready for review
November 7, 2026 07:46
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4856 +/- ##
=======================================
Coverage 92.42% 92.42%
=======================================
Files 360 360
Lines 10935 10935
Branches 949 949
=======================================
Hits 10107 10107
Misses 706 706
Partials 122 122 🚀 New features to boost your workflow:
|
This branch was successfully deployed
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.
What
With Docker Compose,
/admin/login/returns a 500:Django gets its admin base template from the Astro dev server at
http://custom-admin:3002. Vite rejects that hostname because onlylocalhost,*.localhostand IP addresses are allowed by default.#4841 upgraded Astro from 5.0.5 to 7.4.4, which moved Vite from 6.0.3 to 8.3.5. The host check was added in Vite 6.0.9, so the old version didn't have it.
This only allows the Docker service name, and other hostnames still get a 403. Production isn't affected, because
astro_proxyreturns 404 whenDEBUGis off.Docs:
server.allowedHostsserver.allowedHostsTesting: ran
custom-adminandbackendwith Docker Compose./admin/login/went from 500 to 200, and a request to the Astro server withHost: evil.examplestill returns 403.ToDo
Nothing left.