Fix running ng serve (alt): Set allowed hosts via environment variable#19691
Merged
Fix running ng serve (alt): Set allowed hosts via environment variable#19691
ng serve (alt): Set allowed hosts via environment variable#19691Conversation
Vite now supports specifying allowed hosts as an `__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS`. Alternative fix to a1555af: Only overrides allowed hosts in the development environments that need it (i.e. Docker + TLS stack). See: https://vite.dev/config/server-options.html#server-allowedhosts See: vitejs/vite#19325
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR moves the Vite development server's allowed hosts configuration from the Angular build configuration to an environment variable approach, allowing for more flexible configuration in different deployment environments.
- Removes hardcoded
allowedHostsconfiguration fromangular.json - Adds environment variable
__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTSto Docker TLS configuration - Includes a minor grammar fix in documentation
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend/angular.json | Removes hardcoded allowedHosts configuration for development target |
| docs/development/development-environment/docker/README.md | Corrects grammar in test documentation |
| docker/dev/tls/docker-compose.core-override.example.yml | Adds environment variable for allowed hosts and port mappings |
ng serve (alt): Set allowed hosts via environment variable
|
|
||
| frontend: | ||
| environment: | ||
| __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS: "openproject-assets.local" |
Contributor
There was a problem hiding this comment.
Assuming that it's non-breaking for other users, could we specify this on the docker-compose.yml already? Then it would work out of the box for everyone using the default hostnames. If you want to use a different hostname, the override is still possible.
It seems to be fine to have these ports settings as well as __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS envvar set in docker-compose.yml directly. So, there is less to override to get your docker TLS dev stack working.
NobodysNightmare
approved these changes
Jul 24, 2025
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.
Developers will need to manually updated theiredit: not anymoredocker-compose.override.ymlon merging this PRVite now supports specifying allowed hosts as an
__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS.Alternative fix to #19687 / a1555af: Only overrides allowed hosts in the development environments that need it (i.e. Docker + TLS stack).
See: https://vite.dev/config/server-options.html#server-allowedhosts
See: vitejs/vite#19325