1

I'm trying to create a development environment with .localhost as the FQDN.

I'm using Local by Flywheel which is basically MAMP, its a GUI which lets me create vagrant boxes. I can create a site such as example.dev and point it to my local IP address in the /etc/hosts file and it works great:

192.168.95.100 example.dev 

And I can change it to something else like example.test and it still works great:

192.168.95.100 example.test

If I change it to .localhost I get a 403 forbidden error.

192.168.95.100 example.localhost

There are no other records in my /etc/hosts file. I'm trying to work out at what stage the domain is routed somewhere else.

What would prevent the localhost domain from mapping to the correct URL?

Djave
  • 141
  • 2
  • 10

1 Answers1

4

You can't. The localhost is already reserved as a Special-Use Domain Name (RFC 6761, 6.3).

The domain localhost. and any names falling within .localhost. are special in the following ways: - -

  1. 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).

You may have confused this with .local, widely used in private networks and reserved special-use domain name for Multicast DNS (mDNS) in RFC 6762. When using .local, try avoid resolving those names using global DNS. Using .local in Active Directory is a classic example of very bad implementation causing unnecessary queries to L root name server.

Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122
  • In summary, make up whatever `.test` you want, or register a domain and use that namespace, like `wwwdev.example.com`. Anything else may not work as expected in the DNS. – John Mahowald Nov 06 '17 at 14:39