I was looking at the IIS metabase which stores the host header as xxx.xxx.xxx.xxx:<port>:<host header> and it seemed that you may be able to specify the host header in the URL with a colon after the port, but that's not the case as Tomkmvp points out. The host header is stored in the application layer, while the IP and Port are stored in the TCP/IP transport layer. So in the case of an IP address using a default port 80, it appears that IIS sends all requests to the default website (sharepoint services website in my case). The alternative being that you have a registered domain name for each site hosted on your IIS, and in that case, IIS is able to resolve these domain names as host headers on the same IP and Port.
I've been working with the URL Rewrite/Redirection concept offered by Jeff. There is the ASP.net level URL Rewrite and the ISAPI Filter level URL Rewrite. To use ASP.net URL Rewrite, the request must be for a page with an asp extension (*.asp, *.aspx, etc.) so that IIS knows to hand off the request to ASP.net where the rewrite code can be executed. That's too far down the IIS pipeline where my goal is an extensionless URL Rewrite (http://xxx.xxx.xxx.xxx/Test). To create an extensionless URL Rewrite, you have to move up the IIS pipeline to the ISAPI Filter level. This required that I create a IIS Filter as a DLL file, and I found a good article at The Code Project http://www.codeproject.com/isapi/isapiredirector.asp that shows how to implement this.
I was able to modify, compile and run The Code Project sample ISAPI Filter code successfully to perform URL Rewrites within the default website. Ultimately, I was hoping that I would be able to redirect to the intranet host headers like http://Test, but that did not work. I know that my host headers on the intranet do work. Either IIS cannot make that connection (between a path and a host header), or my function code is incorrect for this. To illustrate, below is an example of one of my failed attempts:
DWORD CredirectorFilter::OnPreprocHeaders(CHttpFilterContext* pCtxt,
PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo)
{
// TODO: React to this notification accordingly and
char buffer[256];
DWORD buffSize = sizeof(buffer);
BOOL bHeader=pHeaderInfo->GetHeader(pCtxt->m_pFC, "url", buffer, &buffSize);
CString urlString(buffer);
urlString.MakeLower(); // for this exercise
if (urlString.Find("Test") != -1) //we want to redirect this file
{
urlString.Replace(http://xxx.xxx.xxx.xxx/Test, http://Test);
char *newUrlString= urlString.GetBuffer(urlString.GetLength());
pHeaderInfo->SetHeader(pCtxt->m_pFC, "url", newUrlString);
return SF_STATUS_REQ_HANDLED_NOTIFICATION;
}
// return the appropriate status code
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
I've done a lot of testing and found that the code above returns header informatiion that appears to be relative within the default website. For example, I am able to replace "\default.cfm" with "\default.htm" or \default.cfm" with "\Test\default.htm" successfully. But I am having trouble redirecting to something like http://www.microsoft.com.
Again, my overall question is how to come into IIS on an IP address and Port 80, and direct the request to a specific website on IIS in a way that Sharepoint remains intact on the default website.
My current thinking is that an ISAPI Filter may be an option. Any help with the ISAPI Filters would be greatly appreciated.