IIS ARR balancing accross sites - iis

I would like to have a site:
subdomain.xxxx.com
and let IIS/ARR with round robin/sticky session choose between
subdomain1.xxxx.com
subdomain2.xxxx.com
Is this possible to achieve with IIS/ARR? It seems that you only can add servers, not sites in ARR.
I've tried with web garden, but for some reason the webapplication doesn't work with that setting.

Related

IIS Reverse proxy configuration

I have two sites in my IIS 8 server. Site MyProjectA and MyProjectB, for each project I have a domain name, lets say myprojecta.com and myprojectb.com. I have set in my DNS provider that both domains points to the server IP. I have configured so MyProjectA runs on 443 and MyprojectB runs on 8181, both SSL.
So if I browse to:
https://myprojecta.com I see MyProjectA and its working fine
If I browse to:
https://myprojectb.com:8181 I see MyProjectB and that is working
fine.
But now I wonder, how can I configure so I can omit the :8181 part, and in turn reach MyProjectB site by browsing to https://myprojectb.com only (and with correct certificate). As far as I understood this should be possible with a reverse proxy configuration in IIS but I cannot get it to work. Anyone can help how to achieve that?
Since you are using IIS 8, the simplest approach is to set up multiple HTTPS sites at port 443 using SNI support. Then there is no need of reverse proxy.
Reference

IIS ARR reverse proxy for single website hosted on IIS

I have many sites hosted on IIS on same machine. Only for one site, I need to have reverse proxy setup. I have written rewrite rules for this site and forward some request to another site hosted on different machine.
Will enabling proxy on application request routing affect other sites? Will it have an affect the performance of other sites?
Eg: I have following websites(few are wcf services)
localhost/A
localhost/B
localhost/C
localhost/D
Only the website C needs reverse proxy, so I have written rewrite rules for it. How will enabling proxy effect A, B and D sites
Yes you can enable Reverse proxy for one website and ensure that it does not affect the others.
You mentioned that you have 4 websites but in the example, you gave description of "application" and not website. Since its unclear what your architecture looks like, I'll go ahead and give solution to both.
Considering you have a single website and multiple applications within it but you want to enable proxy for just one application, following is what you need to do. Open the URL rewrite section, under pattern, choose regular expression and add ^application_name/(.*) For example, ^c/(.)
But if you have multiple websites and want to reverse proxy just one of them, then open URL Rewrite and add a condition for "HTTP_HOST" and its value. This will ensure that only requests for specific website's hostname will be reverse proxied.
With respect to performance, having URL rewrite on one of the websites will not have any impact on other websites. If you are still unsure and want to play it safe, you can have each website running on separate application pool. That way they have their own w3wp process and are independent of each other.

Reverse proxy in Azure with Web Apps

I'm moving from Apache on Linux to Azure Web Apps and I have a specific url (mysite.com/blog and everything under it) that is configured with a reverse proxy so the end user doesn't know that the content is actually coming from another service.
I'm sure I can do this within Web Apps (which runs on IIS) but I can't find any documentation on how to do this. As a backup I'm open to putting another service in front of my Web App.
How can I accomplish this in Azure?
Update: I did try using another service - Functions. My architecture looks like this:
This works in production but I'm hitting snags in development. /blog may or may not work depending on the entry point. In prod, our DNS will be configured so mysite.com points to mysite-proxy.azurewebsites.net and, therefore, any URI the user hits will work. In dev, however, we may want to browse to hit /blog from the Traffic Manager which will route us to /blog on the webapp which doesn't exist. Same problem, of course, if we go to /blog directly on the webapp. I tried to show these examples on the right side of the diagram.
I would like to find a solution so the webapp itself can handle the /blog proxying and then we can determine whether it's worth the speed and cost tradeoff compared to the existing solution.
You might want to checkout Azure Functions Proxies: https://learn.microsoft.com/en-us/azure/azure-functions/functions-proxies
Sounds like you want an Application Gateway (caution, costs like $15/day)
The AGW can have multiple listeners against multiple hostnames, including path-based routing.
You will want to add two backends, one for the /blog endpoint and one for the non-/blog stuff. The backends just take the IP or FQDN of the target resource, in this case you will have:
blogBackend: myblog.com
defaultBackend: myWebapp.azurewebsites.net
Then you need to add listeners for your public-facing domain, it would be like:
myHttpListener: port 80, hostname=mywebsite.net
myHttpsListener: port 443, hostname=mywebsite.net
Then you need an HTTP setting
myHttpSetting: protocol=HTTPS, port=443, useWellKnownCACert=Yes, HostnameOverride=Yes,pick from backend target
Then you need rules, one for http=>https redirect, and the other for handling the pathing
myRedirectRule: type=basic, listener=myHttpListener, backendtargettype=redirection, targettype=listener, target=myHttpsListener
myRoutingRule: type=path-based, listener=myHttpsListener, targettype=backendpool, target=defaultBackend, httpSetting=myHttpSetting, pathRules=
path=/* name=root backendpool=defaultBackend
path=/blog name=blog backendpool=blogBackend
You can create additional http settings and assign them to the path rules to change the behaviour of the reverse proxy. For example, you can have the user's URL be https://mywebsite.net/blog, but have the path stripped on the request to the blog so the request looks like myblog.com instead of myblog.com/blog
There's a lot of tiny parts, but the app gateways can handle multiple applications at scale. Biggest thing is to watch out for the cost since this is more of an enterprise solution.

Redirection doesn't work from ARR but works within DNN

We have an IIS web farm, of which consisting an load balancer, 4 ARRs, and 2 ASP.NET application servers running DNN CMS. The 4 ARRs will URL rewrite to DNN application servers. We have more than 100 URLs that need to be redirected into more specific resources within the website.
For example, when a user types in http://www.abcd.com/product1 from outside, the desired outcome is to redirect to www.abcd.com/index.aspx?articleid=1234 , we have configured such behavior within DNN environment, and we can sure that it works, as when we browse the site within the DNN application server, the DNN is able to detect the URL and perform redirection accordingly.
Problem occurs when we attempt to browse the http://www.abcd.com/product1 from LB and ARRs, when we type http://www.abcd.com/product1, it simply go back to http://www.abcd.com mainpage, which the redirection doesn't work at all. No IIS level HTTP redirection has been performed at the ARRs and LBs, the only setting is the default URL rewrite rule which will rewrite the URL to backend DNN servers.
Same question has been posted in IIS forum as well, it is just that I decided to post it here again to gain more exposure.
When going through the ARR are you calling off to the specific IP? For example does http://www.abcd.com/product1 become http://xxx.xxx.xxx.xxx/product1 by chance?
If so, you might want to add those as additional portal aliases to the DNN site.
Otherwise, you will might want to use something like Fiddler to see exactly what is going on with redirects/responses.

Sharing single application across a 2 subdomains in IIS7

I have an application that is currently deployed (ex. www.example.com ). However, now we have a "secure" subdomain, which will take all of the requests that need to be encrypted (ex. secure.example.com). The site that is at www.example.com is currently mapped to C:\inetpub\example.com\wwwroot\, and I've mapped secure.example.com to C:\inetpub\example.com\wwwroot\secure.
However, since secure.example.com was setup as a new website within the IIS Manager, when the secure site is visited, it displays an error since there is no web.config associated with this website; however, this is the way I want it since I want this to be a part of the application that is in the parent directory.
I think what you really meant to do was just right click on the web site for example.com and edit the bindings. In there you can add host names to that site.
Make sure you add them for port 443 which is SSL.
Map both the IIS virtual directories/web sites to the same directory, and check that are both using the same IIS application name.
(Not tried this, but can't recall seeing anything to say it would not work.)

Resources