In today's "Safari. Why are you like this?"
It turns out Safari will not resolve subdomains for *.localhost
https://bugs.webkit.org/show_bug.cgi?id=160504#c5
https://caddy.community/t/localhost-on-osx-works-in-chrome-but-not-safari/19639
https://marijkeluttekes.dev/blog/articles/2024/03/25/custom-localhost-urls-with-caddyfile-on-macos/#bug-report-safari
https://stackoverflow.com/a/77543890
the unfortunate answer is "run your own DNS server locally", or edit /etc/hosts with the subdomain.
So for me this worked:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 foo.localhost
@mahryekuh I'm assuming thats your blog post!
=> More informations about this toot | More toots from konnorrogers@ruby.social
@konnorrogers That’s my blog post. 🥲
See also:
https://fosstodon.org/@mijndert/113787479625878576
Cc. @mboelen @mijndert
=> More informations about this toot | More toots from mahryekuh@fosstodon.org
@konnorrogers Separately, I was curious about doing this on Windows, but it doesn't resolve subdomains of localhost at the system level either:
ping test.localhost
Ping request could not find host test.localhost. Please check the name and try again.
If I try something like http://test.localhost:8000 in Chrome, however, it does work.
Not sure what to take away from this. Maybe that this name resolution is just a feature of Chrome, regardless of OS. @mahryekuh
=> More informations about this toot | More toots from jscholes@dragonscave.space
@jscholes @konnorrogers I can confirm it works in Chromium and Firefox, so it could still equally be Safari being "special" (because Apple loves being special)
But who knows? 🤷🏻♀️
=> More informations about this toot | More toots from mahryekuh@fosstodon.org
@mahryekuh @jscholes
"If it works in Safari, it will most likely work everywhere else" is what I find myself saying pretty regularly
=> More informations about this toot | More toots from konnorrogers@ruby.social
@konnorrogers It also works in Firefox on Windows. So the issue seems to be that: Safari uses the system DNS resolution, the system DNS resolution doesn't resolve subdomains of localhost, and Safari doesn't include special handling to overcome that fact.
I'm being slightly pedantic on purpose. Because if the system DNS doesn't resolve "whatever.localhost" correctly, there'll be unexpected results when developing non-web services. E.g. if you're building or using an FTP server on "myfpt.localhost", clients won't be able to connect to it unless they include the same workaround as Chrome and Firefox.
TL;DR: the system DNS resolution should probably be better, and no browser should need to implement special handling. @mahryekuh
=> More informations about this toot | More toots from jscholes@dragonscave.space This content has been proxied by September (3851b).Proxy Information
text/gemini