Testing SSL certificates without a domain name

Recently at Headscape we were setting up a new server ready to launch a redesign of a site. Whilst testing we were accessing the site using the server’s IP address which works fine for checking everything is working, apart from when we needed to install the SSL certificate.

The SSL certificate is based on a domain name so going to an IP address causes the SSL certificate to warn of an insecure connection. Not very helpful when you’re checking to see if everything has been setup correctly.

This is the solution we came up with.

Say our server is on an IP address of 123.456.78.9 and the domain name is reallysecure.com

Adding an entry to the hosts file of

123.456.78.9 reallysecure.com

will cause the browser to go to the new server when we request reallysecure.com

The server will see that the incoming request is for the domain name that matches the SSL certificate and, providing everything has been installed correctly, we will be accessing the site over https.