Multiple SSL websites on same IP address on IIS 6

iis-6ssl-certificate

I am trying to setup two websites on IIS 6 with two diffent domain names – a.mysite.com and b.mysite.com. And, i want to secure these sites with SSL. So, i got two certificates for each of the domains and installed it on IIS. When i try to access a.mysite.com over SSL, it works. But, accessing b.mysite.com over SSL throws message

b.mysite.com uses an invalid security
certificate.

The certificate is only valid for
a.mysite.com

(Error code:
ssl_error_bad_cert_domain)

Also, i couldn't start b.mysite.com on IIS stating the port is already in use. I see a couple of problems here to solve.

How can i run both the websites on IIS with SSL?
What is the cause of certificate error?

Thanks for reading!

Updated:

Found a similar posting on SO here:
IIS6: Web Site presenting the wrong SSL certificate

Best Answer

The problem is that SSL negotiation is done before the host headers are sent, so you can only have one SSL cert per IP address. This is why you are getting the invalid certificate on b.mysite.com

there are two ways to handle this:

  1. Get a wild card cert for *.mydomain.com
  2. Assign a second IP to the server and run b.mysite.com off this second IP with the proper cert.