Nam G VU
Nam G VU

Reputation: 35374

Localhost 's subdomain with port numbers, how to?

We know that to add a subdomain for localhost, we open and edit the host file by adding lines such as:

127.0.0.1  localhost
127.0.0.1  abc.localhost
127.0.0.1  xyz.localhost

My problem is that: if I browse abc.localhost:88 I get the below error:

Bad Request - Invalid Hostname
HTTP Error 400. The request hostname is invalid.

Why doesn't the URL abc.localhost:88 browse to 127.0.0.1:88 ?

Please help.

Upvotes: 2

Views: 2754

Answers (2)

Wim
Wim

Reputation: 12082

As well as putting the entry in the client's hosts file, you will need to add the appropriate host header abc.localhost to the IIS site that's configured for port 88.

In IIS manager (inetmgr.msc), website properties, website tab, advanced, and add your host header there.

Upvotes: 1

Klaus Byskov Pedersen
Klaus Byskov Pedersen

Reputation: 120937

Because you need to an entry for abc.localhost to your hosts file. If you already have, then make sure that your webserver is listening on port 88.

If you are using IIS, make sure that you have added a binding to the correct hostname (abc.localhost).

Upvotes: 3

Related Questions