Skip to content

Commit e51b931

Browse files
committed
fix: avoid macOS mDNS 5s delay on .local hosts entries
If applied, this commit will make the documented /etc/hosts lines for the core and stepup environments resolve instantly on macOS instead of taking ~5 seconds per fresh hostname lookup. Why is this change needed? Prior to this change, the /etc/hosts lines had the IP address followed directly by a real hostname. On macOS, any .local hostname looked up this way is first tried via multicast DNS (Bonjour), which times out after ~5 seconds before falling back to /etc/hosts -- regardless of the entry being present. A typical login flow crosses several *.dev.openconext.local subdomains in sequence, so this tax stacks up to several seconds per redirect hop. How does it address the issue? Adds a throwaway alias word ("oc1"/"oc2") directly after the IP address on each affected line. A word in that position is enough to make macOS treat the line as a normal /etc/hosts entry and skip the mDNS attempt, cutting resolution to milliseconds. Updates both README.md files and the line init.sh prints during setup, with a short comment explaining why the leading word is there. Links / references: https://www.peterbe.com/plog/make-.local-domains-not-slow-in-macos
1 parent c7dc2ce commit e51b931

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

core/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ To start the environment again after the initial setup, a single terminal is suf
3333
You will also need to tell your local machine where to find the hosts.
3434
Add the following line in your hosts file (/etc/hosts):
3535
```
36-
127.0.0.1 engine.dev.openconext.local manage.dev.openconext.local profile.dev.openconext.local engine-api.dev.openconext.local mujina-idp.dev.openconext.local profile.dev.openconext.local connect.dev.openconext.local teams.dev.openconext.local voot.dev.openconext.local pdp.dev.openconext.local invite.dev.openconext.local welcome.dev.openconext.local
36+
127.0.0.1 oc1 engine.dev.openconext.local manage.dev.openconext.local profile.dev.openconext.local engine-api.dev.openconext.local mujina-idp.dev.openconext.local profile.dev.openconext.local connect.dev.openconext.local teams.dev.openconext.local voot.dev.openconext.local pdp.dev.openconext.local invite.dev.openconext.local welcome.dev.openconext.local
3737
```
38+
The leading `oc1` matters on macOS: without a word directly after the IP,
39+
`.local` hostnames take ~5s to resolve because macOS tries multicast
40+
DNS (Bonjour) first before falling back to /etc/hosts.
3841

3942
If all goes well, you can now login. Please see the section below to find out where you can login.
4043

core/scripts/init.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ printf "\n"
128128
echo -e "${BLUE}Please add the following line to your /etc/hosts: ${VINKJE}"
129129
printf "\n"
130130

131-
echo "127.0.0.1 engine.dev.openconext.local manage.dev.openconext.local profile.dev.openconext.local engine-api.dev.openconext.local mujina-idp.dev.openconext.local profile.dev.openconext.local connect.dev.openconext.local teams.dev.openconext.local voot.dev.openconext.local invite.dev.openconext.local welcome.dev.openconext.local"
131+
# The leading "oc1" alias avoids macOS's ~5s mDNS/Bonjour timeout for .local
132+
# hostnames -- without a word directly after the IP, macOS tries multicast
133+
# DNS first for every .local lookup before falling back to /etc/hosts.
134+
echo "127.0.0.1 oc1 engine.dev.openconext.local manage.dev.openconext.local profile.dev.openconext.local engine-api.dev.openconext.local mujina-idp.dev.openconext.local profile.dev.openconext.local connect.dev.openconext.local teams.dev.openconext.local voot.dev.openconext.local invite.dev.openconext.local welcome.dev.openconext.local"
132135

133136
printf "\n"
134137
echo "You can now login. If you want to bring the environment down, use the command below"

stepup/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ The application config directories contain the SAML key material. Those are not
1818
First, you need to create an entry in your hosts file (/etc/hosts on *nix systems)
1919

2020
```
21-
127.0.0.1 selfservice.dev.openconext.local ssp.dev.openconext.local gateway.dev.openconext.local middleware.dev.openconext.local ra.dev.openconext.local demogssp.dev.openconext.local tiqr.dev.openconext.local webauthn.dev.openconext.local azuremfa.dev.openconext.local
21+
127.0.0.1 oc2 selfservice.dev.openconext.local ssp.dev.openconext.local gateway.dev.openconext.local middleware.dev.openconext.local ra.dev.openconext.local demogssp.dev.openconext.local tiqr.dev.openconext.local webauthn.dev.openconext.local azuremfa.dev.openconext.local
2222
```
23+
The leading `oc2` matters on macOS: without a word directly after the IP,
24+
`.local` hostnames take ~5s to resolve because macOS tries multicast
25+
DNS (Bonjour) first before falling back to /etc/hosts.
2326

2427
Secondly you need to create the `stepup/gateway/surfnet_yubikey.yaml` file with your Yubikey API credentials.
2528
If you do not have API credentials, you can get them at <https://upgrade.yubico.com/getapikey/>.

0 commit comments

Comments
 (0)