Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking how to force an exact hostname match within IIS when using https. For instance, I want "" to be ok, but "" to return 404 (assuming they both resolve to the same IP).

IIUC, the default behavior of IIS when going to "" is to get a cert warning, if the user presses continue, the user is able to access the URL.

I was able to do this by generating a * SSL cert, and then specify the hostname within the bindings in IIS, but without the * in the beginning, the hostname field is disabled and blank.

Am I missing something simple here?

share|improve this question
Yes -- IIS (even 7.5) does not support host name when processing HTTPS request -- SSL is bound to IP:port pair and is processed like that. There is some workaround (to allow to use the same cert on multiple sites) but that still does not solve the issue for you. Better do what you did already -- wildcard certificate and then rewrite rule. – LazyOne Jun 20 '12 at 15:10
@LazyOne: Not true. Someone's already beaten me to the answer below. You can't bind host headers with SSL in the IIS Manager, but you can do it using AppCmd or PowerShell. – abitgone Jun 20 '12 at 15:22
@abitgone IIS 7.x does not support hostnames for HTTPS because it works on IP:port pairs (just a reminder, in case you are not aware: SSL connection/handshake occurs before HTTP part kicks in). This is the problem with any web server. That's why Server Name Indication was created/implemented -- unfortunately IIS 7.5 does not support it yet (only in v8). -- this allows multiple SSL certificates to be bound to the same IP:port pair – LazyOne Jun 20 '12 at 15:40
@abitgon If solution in MichelZ's answer allows to solve the issue, then it's all good and I just misunderstood the question. – LazyOne Jun 20 '12 at 15:43
@LazyOne: Again, not strictly true. You've been able to add host headers with IIS for some time now, since IIS 6.0. What you do need is a single cert which can work with multiple host names – so multi-domain UCC certs or wildcard certs. For example:… – abitgone Jun 20 '12 at 16:05

What you want is called "host headers"

You can do host headers in the UI for HTTP connections only, for SSL, you need appcmd:

appcmd set site /"<IISSiteName>" /+bindings.[protocol='https',bindingInformation='*:443:<hostHeaderValue>']

See here for more details

share|improve this answer
Thanks - I tried this, but it seems that even with this there needs to be the initial binding with no host headers defined. So IIUC, my whole scenario can be addressed, but having 2 web sites, one that doesn't publish anything but with the ssl binding with the blank hostname and another with my app and with the binding with host headers. Does this sound reasonable? – iis_newbie Jun 20 '12 at 17:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.