Bug 160504 - Localhost subdomains don't work
Summary: Localhost subdomains don't work
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: Safari 9
Hardware: Mac All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-08-03 06:21 PDT by Dave Jeffery
Modified: 2020-12-09 09:28 PST (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Jeffery 2016-08-03 06:21:29 PDT
Summary:
Localhost subdomains (i.e. 'http://mysite.localhost') don't work in Safari. They work ok in all other web browsers (Chrome, Firefox, Opera etc..).
I am not sure if this is a Safari/OS X issue or a webkit issue, feel free to close this bug report if that is the case.

Steps to Reproduce:
1. Start up a local server that responds to the host header of 'mysite.localhost' on port 8000 (any port is fine)
2. Try to access the site in safari using the url: http://mysite.localhost:8000/

Expected Results:
Every other web browser (Chrome, Firefox, Opera etc..) that I have tested will find the server and load the page as expected. Localhost subdomains don't seem to be mentioned in any official spec but the fact that they work in every other browser means that people use them for real-world development.

Actual Results:
Safari gives the error "Can't find server"

Version:
Tested on OS X 10.10 and OS X 10.11 with Safari 9.1.2.
Comment 1 Irakli Gozalishvili 2020-07-08 11:04:01 PDT
https://tools.ietf.org/html/rfc6761 suggests that "localhost" can be treated specially and should hardcode localhost names to the loopback address:

>  "Application software MAY recognize localhost names as special"

and:

>  "Name resolution APIs and libraries SHOULD recognize localhost
>   names as special and SHOULD always return the IP loopback address
>   for address queries and negative responses for all other query
>   types.  Name resolution APIs SHOULD NOT send queries for
>   localhost names to their configured caching DNS server(s).)."


Chrome already support supports / ships this:
https://bugs.chromium.org/p/chromium/issues/detail?id=510124

And firefox is working on this:
https://bugzilla.mozilla.org/show_bug.cgi?id=1220810

It also appears that some of the web platform tests do test for this and were disabled:
https://bugs.webkit.org/show_bug.cgi?id=161142


Any chance of get Safari to get Safari localhost to loopback address ?
Comment 2 Radar WebKit Bug Importer 2020-10-27 06:49:00 PDT
<rdar://problem/70720358>