Website works remotely but not on the server itself when called by domain

Viewed 475

I am using Windows Server 2019 and in IIS 10 I have created a website and I have bound it to both: "localhost" and "mydomain.com" on port 80.

mydomain.com works correctly from any client but on the server only when I call "localhost" it works otherwise I get the following error (when called by domain):

enter image description here

2 Answers

Configure your DNS in your local server to resolve the domain name as localhost

On clients, your request domain.com is resolved by its configured DNS. It can be on public DNS (internet) or private ones (company, intranet).

From the server domain.com, do you have access to the same DNS than your clients use ?

If not, either configure additional DNS servers : https://serverspace.io/support/help/configuring-a-dns-server-on-windows-server-2012-or-later/

or you could edit you Host file of mydomain.com (local DNS): C:\Windows\System32\drivers\etc\hosts

It may look like that :

127.0.0.1   localhost
127.0.1.1   mydomain.com

# and existing settings
Related