I have 2 different websites:
mysite.com
api.mysite.com
I want to be able to serve both of these websites from the same webserver (same IP) and same port number.
I have followed this document, and created the following websites:
This is how the binding for mysite.com
looks like:
And this is how the binding for api.mysite.com
looks like:
Note that the only way I could define 2 sites using the same IP and Port was to use a Host name for one of them.
With the above settings, mysite.com
works but api.mysite.com
does not work. If I stop mysite.com
from IIS, then api.mysite.com
starts working.
The document that I used as a guide explains that I need to use dnsmgmt.msc to define a CNAME for api.mysite.com, but here is where I am confused. I am using AWS and I have defined 2 CNAME records for these websites in Route 53. Do I still need to define a CNAME record for one of these websites in Windows?
If not, then how would I tell IIS that request containing api.mysite.com
should be sent to website having the host name = api.mysite.com
?
Update
The answer provided by Greg suggests that I would add mysite.com as Host name as well. If I follow this solution, how would I handle requests for www.mysite.com
?
At the moment, any request for mysite.com
is permanently redirected to www.mysite.com
Add mysite.com to the binding for that site to match the similar configuration for api.mysite.com
My guess is that the mysite.com one is matching the request condition for api.mysite.com (just port 80).
yes, just add mysite.com to the binding