Iis – Translating Localhost to Fully Qualified Domain Name

httpsiiswindows-server-2012

I'm setting up a server that will be used for automated UI tests against a web interface. I'm using Chromedriver as the browser driver, so it just takes a passed in URL from the test code.

Because of the way the automation is set up, I use a generic URL: https:\\localhost\<blah>.

However, this generates a certificate warning because we are using localhost and not the fully qualified domain name, so it doesn't match up. I'm using a self-signed certificate since these are not Internet-facing servers and are disposable machines.

My question is, on a Windows Server 2012 IIS server, how can I either tell IIS to recognize localhost as the same as servername.forest.domain.com, or translate this somewhere on the server?

If it's not possible to do this at the server layer I'll look at changing the test code to pull from a servername variable instead, but I wanted to see if this was an option first.

Best Answer

You can create a host entry for the Server IP address in %SystemRoot%\system32\drivers\etc\hosts file for your fqdn.