This repository was archived by the owner on Nov 16, 2026. It is now read-only.
Repository navigation
Make ng serve answer on both localhost and 127.0.0.1 - #33
Merged
Merged
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 changed:
angular.json:ng servenow listens on127.0.0.1. Before, it listened only on IPv6::1, sohttp://127.0.0.1:4200refused to connect and onlylocalhostworked. Browsers and curl fall back from::1to127.0.0.1forlocalhost, so both URLs load now.application.yml: addedhttp://127.0.0.1:4200to the default CORS origins. Without it, a browser on127.0.0.1:4200would get a CORS 403 on login. The list already had127.0.0.1:4201.SecurityIT: the preflight test also checks the127.0.0.1:4200origin.Why: if someone types the IP during the demo, it should just work.
How tested:
ng serve --port 4303: curl gives 200 on bothhttp://localhost:4303/andhttp://127.0.0.1:4303/. Headless Chrome renders the login page on both. lsof shows it listening on127.0.0.1.mvn -B clean verify: 99 tests, 0 failures.http://127.0.0.1:4200gets 200, fromhttp://localhost:4200gets 200, and fromhttps://evil.examplegets 403.Note: a running backend needs a restart to pick up the new CORS origin.