Sunday, September 26, 2010

Wildcard domain problems with IIS 6.0/7.X

Today, when you want a wildcard domain to point to your site you need to do 2 things:
1) add a wildcard A record to your DNS:

2) add a wildcard entry to your IIS web site:
IIS control panel->right click on your web site-> properties->"web site" tab->advanced

Here you "Add" a site with en empty host header value.

This is the method to send all undefined host web server requests to this site.

For example:
if you have a few web sites defined in IIS (on the same web site node or an different nodes it doesn't matter) - for instance, & (these are defined with, host headers), when you define an additional 3rd value with an empty host header value on the same port, all other requests will go there ( / / etc ...).
This is like defining one global wildcard per IIS instance.

This is the only way wildcards can be defined for your web site, and if you want to host multiple wildcard domains on the same IIS machine (e.g., * and * you can't ! because the wildcard is a global one "*" and not part of a domain ("*").

There are tricks to circumvent this problem ( ISAPI-Rewrite) but they are complicated , and microsoft IIS dev team are aware this is a problem (, but they haven't provided this feature yet, not even in IIS 7.

There are even commercial products that were built to provide an answer to this problem.

One side note - in apache this is not a problem.

No comments:

Post a Comment

Feel free to comment. No links/URLs allowed in comments.