Monday, 25 August 2014

IIS 8.5 HTTPS on internal and external

Situation: Your site is accessible on 2 different IPs (2 different domains on the same IP will work, too), you have 2 SSL certificates or know how to generate them, and you would like this to appear everywhere:



...because you like the colour green.

e.g. You have a web server behind NAT, with port forwarding set up, and would like to use HTTPS to both the internal and external IP.

I've found that a maximum of ONE IP address may be without an associated domain.

This IP will actually be a fallback when all configured domain names fail to match.

If you need a domain name for a local IP, a local DNS will work fine, or you could probably even edit the hosts file on your computer. Bear in mind that the name used must match up with that on the SSL certificate.

I will assume your certificates are already added to the server.

In IIS, go into "Bindings..." for your website. You may delete any HTTPS bindings that already exist, if they don't contain any special configuration.

Add a binding for each IP:


Easy. Done. Kind of.

There was no domain name for one of my IPs, and I had a small issue. Leave "Host name" blank for this IP. Now, this will be the default HTTPS binding when all other bindings fail to match. However, I found that whenever I changed the SSL certificate on either HTTPS binding, it would change on both of them!

It seems like a bug to me, but I found a workaround: Add an extra (dummy) HTTPS binding, with garbage for the host name, then change the SSL certificates for each binding, followed by deleting the dummy binding.