I have an IIS application and three sub-applications as follows:
CMT (Windows and Anonymously authenticated)
- CI
- EM
- Website (Windows authenticated)
CI and EM are helper web services and Website is -obviously- the website. Now, if the application is hosted under cmt.mycompany.com, then the user can access the website as follows:
cmt.mycompany.com/website/mypage
I want to write a URL Rewrite rule so that our users don't have to write 'website' after the DNS, and can simply open cmt.mycompany.com
or cmt.mycompany.com/mypage
to open the main page or mypage, respectively.
<rule name="WebsiteMapping" stopProcessing="true">
<match url="^(?!\b(?:ci|em|website)\b).*$" />
<action type="Rewrite" url="http://{HTTP_HOST}/website/{R:0}" logRewrittenUrl="true" />
</rule>
What this rule does is simply rewrite any URL that doesn't start with ci
, em
, or website
to have website
added after the DNS.
I am having two problems that I don't seem to be able to solve:
For some reason, URL Rewrite doesn't seem to work with authentication so whenever I hit
cmt.mycompany.com
, I get a dialog ask me to authenticate myself and it doesn't work even if I enter my credentials. Since the main application (CMT) and the website are hosted under different app pools, we needed to install IIS ARR, but that didn't help.I tried to change the rule to 'redirect' and it did work, but there is another problem. So I have a load balancer connected to 4 individual boxes. The load balancer is hosted under port 80, but the individual boxes are hosted under port 9991. When I hit the individual boxes, the URL redirect works successfully, but when I hit the load balancer dns, the port 9991 (of the individual box) gets appended to the load balancer dns!! For example, if I hit
cmt.mycompany.com/mypage
, I get redirected tocmt.mycompany.com:9991/website/mypage
which is obviously invalid since the load balancer is hosted on port number 80 not 9991.
Any idea to help my solve these problems?
Thanks!
cmt.mycompany.com/mypage
tocmt.mycompany.com/website/mypage
is it will not hit the home page.