53

Is anyone aware of a public wildcard domain name that resolves to IP address 127.0.0.1. For example if I wanted to test a URL locally such as mywebsite.localhost.com or example.localhost.com but I don't have control of DNS settings (hosts file or whatever) then I would use this public DNS to resolve to 127.0.0.1. It needs to be wildcarded so that no matter whatever comes before localhost.com it still resolves to 127.0.0.1.

  • 6
    is it too much to ask for a public wildcard domain pointing to 127.0.0.1 that also has a public ssl cert and public private key? – Collin Anderson Jan 09 '13 at 15:23
  • 1
    @CollinAnderson DNS doesn't provide SSL, it's the server sitting at that IP address that provides SSL, so you would need to set that up locally unfortunately. – Simon East Mar 20 '15 at 03:15
  • Exactly, I would need to install the given SSL key and certificate locally. Basically they would need to buy a wildcard certificate and make their private key public for anyone to use. It's not secure for use over an untrusted connection, but at least browsers won't complain. – Collin Anderson Mar 20 '15 at 15:09
  • One else: ``` $ dig localho.st @8.8.8.8 ;; ANSWER SECTION: localho.st. 14399 IN A 127.0.0.1 $ dig asd.localho.st @8.8.8.8 ;; ANSWER SECTION: asd.localho.st. 14399 IN A 127.0.0.1 ``` – Paramtamtаm Feb 07 '19 at 10:49

17 Answers17

41

*.vcap.me

VMWare maintains this for their open cloud platform.

whit537
  • 1,089
  • 9
  • 8
  • [vcap](https://github.com/cloudfoundry-attic/vcap) repository has been archived by the owner before Nov 9, 2022 – Abirdcfly Jan 03 '23 at 01:43
27

37Signals created a complete domain for mapping to any IP you want, http://xip.io. So for localhost you can using project.127.0.0.1.xip.io

I've had to starting using this for some proxy tools, as they were choking on request that didn't resolved to an IP using an external DNS call.

Ryan Gibbons
  • 3,511
  • 31
  • 32
  • 1
    Perfect. This appears to be the only one that supports non-loopback addresses. :-) – Simon East Mar 20 '15 at 03:24
  • 1
    xip.io is the perfect domain for this use, 10.0.0.1.xip.io resolves to 10.0.0.1, www.10.0.0.1.xip.io resolves to 10.0.0.1, mysite.10.0.0.1.xip.io resolves to 10.0.0.1, foo.bar.10.0.0.1.xip.io resolves to 10.0.0.1 – Harikrishna Jan 07 '19 at 05:45
  • It doesn't seem to support port numbers though? – geoidesic Nov 10 '20 at 11:08
  • Port numbers have nothing to do with DNS resolution. DNS resolution happens, then default port based on protocol or the port specified is used. – Ryan Gibbons Dec 08 '20 at 14:30
14
9

I've just found a great solution: lvh.me

you can try it:

joel1di1
  • 773
  • 5
  • 13
8

We've got a domain you can actually remember for this.

*.lacolhost.com

We'll maintain it for as long as we're able.

Developing with subdomains just got a lot easier: *.lacolhost.com

nhance
  • 81
  • 1
  • 3
6

http://localhost.tv does the trick :-)

I bought since none of the existing 85 localhost domains were pointing at localhost...

Esben von Buchwald
  • 2,772
  • 1
  • 29
  • 37
5

Note: This domain has now lapsed so won't work as described below.

It looks like *.127-0-0-1.org.uk will do what you need.

http://www.ecclestoad.co.uk/2006/08/dns-entry-pointing-to-localhost

Examples:

EvdB
  • 1,759
  • 2
  • 12
  • 19
loudej
  • 1,889
  • 11
  • 17
  • 1
    I let the 127-0-0-1.org.uk domain lapse a while back so this won't work anymore. Sorry. *.vcap.me is a better replacement to use. – EvdB Apr 04 '12 at 13:53
3

http://*.localtest.me seems to work, except readme.localtest.me.

Ben Last
  • 141
  • 1
  • 5
2

If nothing else, you could just register a domain for yourself and set it up so that's how it behaves.

Karl
  • 773
  • 2
  • 9
  • 22
2

Feel free to use *.localhst.co.uk (note missing second 'o'). I'll keep it alive as long as I am, and the internet is still a thing. Handy for people who want to test with two levels of TLD.

Jerome
  • 577
  • 1
  • 3
  • 18
2

You can go to http://afraid.org and register one.. You can get free domains(well subdomains, but you have complete control over A and NS and such records) and point one at 127.0.0.1. They support wild-cards

Earlz
  • 62,085
  • 98
  • 303
  • 499
  • @Earlz :) 127.0.0.1 is not the universal IP address to Rahul's house. That would resolve to local host on the DNS server at afraid.org. – orokusaki Mar 09 '10 at 06:23
  • 1
    @oro What he is looking for then is a dynamic IP service. I understood from the question that he wanted just a domain that pointed at 127.0.0.1 which would be the IP of the person that is browsing the domain. – Earlz Mar 09 '10 at 16:35
  • 1
    Give that a try and see how it works. Look up how DNS works, and you'll understand why it's impossible. – orokusaki Mar 10 '10 at 03:19
  • 1
    Why would it be impossible.. It's just a pointer, it's very well possible to have an A record pointing to 127.0.0.1. – Arda Xi Jul 02 '10 at 12:49
1

If you are using Windows DNS, you can create a new zone, then you DnsCmd to add A records for @ and *.

dnscmd /RecordAdd local * 3600 A 127.0.0.1
dnscmd /RecordAdd local @ 3600 A 127.0.0.1
Hafthor
  • 16,358
  • 9
  • 56
  • 65
0

Why not using the literal IP address in the URL?

  • http://127.0.0.1/ (old IPv4)
  • http://[::1]/ (new IPv6)
bortzmeyer
  • 34,164
  • 12
  • 67
  • 91
  • 3
    My particular problem is I'm using host headers in IIS. In addition I'm working on portal software which displays different content based on the URL requested. –  Oct 14 '09 at 17:07
-1

I have set up my own that you can use:

home.pdobson.com resloves to 127.0.0.1

MrOodles
  • 1,856
  • 21
  • 21
-1

This domain resolves to 127.0.0.1:

www.mouse-potato.com

-1

somesite.com is the first one I knew about, however I found a whole bunch here

http://www.websiteoutlook.com/www.somesite.com

Check the 20 other sites point to 127.0.0.1. I have no idea how long these sites will stay pointing to 127.0.0.1.

-4

Your hosts file in C:\WINDOWS\system32\drivers\etc ought to be able to do this, just add one single line like this:

127.0.0.1 www.mydomain.com

Additionally, use a server like apache or a program with it like wamp, and just go to http://localhost

Cyclone
  • 17,939
  • 45
  • 124
  • 193
  • 1
    I don't see why anyone downvoted this answer. This is the best answer here. What the OP is asking is impossible. – orokusaki Mar 10 '10 at 17:35
  • 5
    Maybe because he says " I don't have control of DNS settings (hosts file or whatever) "? – Arda Xi Jul 02 '10 at 12:48
  • 4
    This fails to answer the question: it creates only one name, `www`, that points to 127, whereas the questioner needs every possible sub-name to point there. And I have no idea why @orokusaki thinks the question is "impossible" since several people offered ways to accomplish the goal quite easily. – Brandon Rhodes Apr 19 '11 at 13:20
  • -1 because the title of the question includes "wildcard" which this answer will not solve. – Costa May 06 '13 at 22:14