Azure ILB ASE with Application Gateway and path based routing - azure

Following situation:
there is an ILB ASE with one App Service Plan running 3 different Web Apps.
I would like to use Azure Application Gateway and its path based routing capability to route to these different Web Apps. Is it event possible?
Thanks!

Ok, got a solution for this:
under "Configure a web app behind an existing application gateway" they describe how to configure the App GW...the most important part is the parameter -PickHostNameFromBackendAddress which kind of takes the host name as it is defined in the backend pool (e.g. app1.myase.local, app2.myase.local etc. these domains are not on the internet but rather inside the VNET only per deployed App Service). Then you need to configure a private DNS zone in the VNET where the App GW and the Apps live. Here is how: https://learn.microsoft.com/en-us/azure/dns/private-dns-getstarted-cli then the path based listener works with multiple apps represented by multiple backend pools in the App GW

Do you want to reach different Web-Ressources ?
For Example:
fqdn:443/web1/
fqdn:443/web2/
fqdn:443/web3/ ?
i think you are looking for: "url based routing"
please read:
https://learn.microsoft.com/de-de/azure/application-gateway/application-gateway-introduction
For trainings you can easily work with Haproxy and multiy instances.
if a client gets /videos/ -> 10.100.1.1:443/videos/ and if a customer want to reach /images/ -> 10.100.1.2:443/images
please analyse my first config entries:
frontend http
acl videos path_end -i /videos/1
acl images path_end -i /images/2
acl pdf path_end -i /pdf/3
use_backend srvs_videos if videos
use_backend srvs_images if images
use_backend srvs_pdf if pdf
backend srvs_videos
balance roundrobin
server host1 10.100.1.1:PORT
server host2 10.100.1.2:PORT

Related

Azure front door to support multiple web app by path under same domain

I have a question about azure front door potential for this. So I have 2 web site running by Azure App Services and I need then under same domain name but different path of URL like this:
App Service A -> www.something.com
App Service B -> www.something.com/b-product
I'm not sure this is possible to use Azure front door or I should use another service to solve this problem.
Do somebody can suggestion to me?
Yes you can do this fairly easily, when you create your routing rule you have the option tom specify patterns to match, there you can specify /foo and have this forwarded to pool A where app service A lives
Then you create a different routing rule with /bar pattern to match and forward that to pool B
Then you can repeat this until you get what you need.
you can also have one routing rule match the / domain as per your example you don't have to use a /foo pattern you can also do /* but I always found it easier to use /foo/* and /bar/* to keep the same URL structure
As suggested by Junnas , you can use the front door rules engine
Alternatively , you can use application gateway listeners
If you want all of your requests (for any domain) to be accepted and forwarded to backend pools, choose basic. Learn how to create an application gateway with a basic listener.
If you want to forward requests to different backend pools based on the host header or host names, choose multi-site listener, where you must also specify a host name that matches with the incoming request. This is because Application Gateway relies on HTTP 1.1 host headers to host more than one website on the same public IP address and port. To learn more, see hosting multiple sites using Application Gateway.

How can I route outbound traffic from an App Service integrated with a VNet containing a Service Endpoint to an external Azure hosted API?

I'm trying to secure my containerized web app with a Premium V2 App Service Plan. I've enabled Service Endpoints for an integration subnet for the different App Services to restrict incoming traffic from each other except for the frontend (so all of them are integrated with the VNet and all have incoming traffic restricted to that VNet except for the frontend).
I have also other Azure services like Azure Functions or a Storage Account that can have inbound traffic restricted by using those Service Endpoints. However, One of the App Services calls an external 3rd party API that lies on Azure too. That API may or not be behind a static IP. However, it has a Custom Domain associated.
The problem arises when I try to connect to that API from one of the VNet integrated App Services. As the destination IP is inside one of the IP ranges that are added to the routing with the use of a Service Endpoint, traffic is sent via that Service Endpoint instead of simple Azure routing. I've tried overriding the route with a Route Table associated to that subnet but that seems not to be possible, with or without a NAT Gateway attached to the subnet. I guess Azure routing is prioritized here. I'm sure the route is not effective as I used it on a different subnet where I deployed a VM.
Is there any way I can use that Service Endpoint for my internal traffic only so it's not used when it goes to an Azure hosted API or I need to switch to a different approach like Private Endpoints or an ASE?
I am unsure what you're looking for but if you want to explicitly define routes you should try using app services setting "WEBSITE_VNET_ROUTE_ALL" = 1 which overrides the default precedence of routing and makes sure that every outbound call follows the route defined inside route table of subnet.
Use the following steps to add the WEBSITE_VNET_ROUTE_ALL setting in your app:
Go to the Configuration UI in your app portal. Select New application setting.
Enter WEBSITE_VNET_ROUTE_ALL in the Name box, and enter 1 in the Value box.
When WEBSITE_VNET_ROUTE_ALL is set to 1, outbound traffic is still sent from the addresses that are listed in your app properties, unless you provide routes that direct the traffic elsewhere.
We've been able to ask the 3rd party to disable blocking rules. It turns out they had a rule that blocked this specific traffic.
I already tried changing that setting, but didn't try putting a route table on it. However, it'd make no difference as I can't define a list of allowed outbound IPs belonging to Azure since we have no static IP to call.

Azure: Route subdomain traffic to different backend port

I have multiple sites hosted on the same machine in Azure on different ports:
foobar.com:8000
foobar.com:8001
foobar.com:8002
etc
I would like to address these by subdomain using a reverse proxy;
aaaa.mysite.com ----> foobar.com:8000
bbbb.mysite.com ----> foobar.com:8001
cccc.mysite.com ----> foobar.com:8002
Is it possible to do this in Application Gateway? It only seems to cater for different paths (not subdomains) and doesn't allow ports to be specified for backends.
Is there another Azure feature that allows for this (e.g. Front Door)?
As your requirement to address them by subdomains in APP GW, you could use multi-site hosting.
There are three common mechanisms for enabling multiple site hosting
on the same infrastructure.
Host multiple web applications each on a unique IP address. Use host
name to host multiple web applications on the same IP address. Use
different ports to host multiple web applications on the same IP
address.
For example, you want aaaa.mysite.com ----> foobar.com:8000. The main configuration will be like this: create a multi-site listener, use frontend port 80 and hostname aaaa.mysite.com in this multi-site listener. HTTP setting should specify the port 8000. Make sure the listener is listening on port 80 and HTTP setting configure your custom port for your backend websites.
In this case, you will create 3 Listeners with on same port 80,and specify the hostnames and create 3 HTTP settings, and create rules with corresponding Listener and HTTP settings and backend pool.
The Azure front door also has URL-based routing and Multiple-site hosting ability. Refer to this document.
Update
Backend pools
Create one backend pool and set your Azure VM as the backend in the backend pool.
Listeners
Click multi-site to create a multi-site listener then save it. You need three listeners for your host name.
Type the subdomains as the host name
Health probes
Add a health probe and checkbox pick host name from backend http settings.
HTTP settings
Add three HTTP settings and specify the custom port on each of HTTP settings.
Rules
Add three basic rules with corresponding Listener and HTTP settings and backend pool.

Endpoint configuration for Service Fabric

I deployed an app on Service Fabric and there's an HTTP listener spawned inside. How can I configure the listening URL in relation to app/cluster?
More precisely, is there any way to build this URL inside the app by retrieving some environment/role parameter ?
Suppose my cluster is called "test", then it will be available at: test.northeurope.cloudapp.azure.com. If I have an app called "Sample" for which I configured an endpoint called "SampleTypeEndpoint" inside ServiceManifest.xml, what would be the complete URL my app would listen to?
The endpoints you configure in ServiceManifest.xml right now fulfill two purposes:
Allow Service Fabric to provide a unique port from an application port range, if you don't need a well-known port.
When opening a web server that uses http.sys, allow Service Fabric to set up URL ACLs for a random port or a well-known port (80, 443, etc) and certificate ACLs for HTTPS.
That's basically it. The actual address on which you open a listener is up to you to determine. Typically, you open a listener on the node IP and use a NAT for ingress traffic on a domain name. In Azure, the NAT is the Azure Load Balancer which is automatically configured to accept traffic on your cluster's VIP as well as the .region.cloudapp.azure.com domain.
Here's a more thorough overview of how this works on Service Fabric cluster in Azure: https://azure.microsoft.com/en-us/documentation/articles/service-fabric-connect-and-communicate-with-services/

service fabric URL routing

I am using the Azure Load Balancer with Azure service fabric to host multiple self host web applications, I'd like to create a rule that allows me to route based on the users URL request.
So for example if a user navigates to :
http:// domain.com/Site1 then the rule would route to:
http:// domain.com**:8181**/Site1 within the cluster
if the user navigates to:
http:// domain.com/Site2 then the rule would route to:
http:// domain.com**:8282**/Site2 within the cluster
Is this possible with azure service fabric/load balancer?
The Azure Load Balancer only forwards traffic it receives on a port to a node in your cluster on another port (can be the same port or a different internal port). It operates on Layer 4 (TCP, UDP) so it doesn't know anything about HTTP or URLs (although it does allow HTTP probes).
Here are a couple options for multiple web sites:
If you want your web sites hosted internally on different ports (8181 and 8282), then you'll need something else to do URL routing. Azure Traffic Manager or Azure Application Gateway are possible options that would run outside your cluster. Your Azure Load Balancer would need to open a port for each web site, but the benefit is this way you can run your web sites on dedicated nodes and the ALB would automatically route traffic to the appropriate nodes based on which ports are open.
Alternatively, you can set up your own stateless routing service that runs inside your cluster.
Or you can skip routing altogether and just host all of your websites on port 80/443. As long as you're using an http.sys-based web host, which includes Katana, ASP.NET Core 1 WebListener, or anything you build on HttpListener, you can use the same port for all your websites and let the underlying http server route according to either a URL path or hostname, both of which are supported.

Resources