Ancestors

Toot

Written by Konnor Rogers on 2025-01-08 at 18:59

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

Descendants

Written by Marijke Luttekes on 2025-01-08 at 19:11

@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

Written by James Scholes on 2025-01-08 at 19:24

@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

Written by Marijke Luttekes on 2025-01-08 at 20:52

@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

Written by Konnor Rogers on 2025-01-08 at 21:44

@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

Written by James Scholes on 2025-01-08 at 21:52

@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

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113794269102512365
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
414.985967 milliseconds
Gemini-to-HTML Time
2.177594 milliseconds

This content has been proxied by September (3851b).