Azure: How does the CDN work together with an Application gateway? - azure

I have a web app which has a decent amount of static content: images, css, some js etc. I was trying to figure out how to deliver those resources.
My first thought was using the storage + CDN setup yet, I would be running into issues since I'm also using a Zuul Proxy as an Application Gateway.
Therefore, if every request goes through the gateway, the gateway itself needs to be replicated across regions and cache content in order to achieve the same performance as a CDN, right?
If this is the case, how does the Azure Application Gateway integrate with it's CDN? Does it maintain the performance of the CDN or drastically lowers it?
Edit
Also, if I have both the Application Gateway and the CDN replicated so much, is it even worth having a CDN? Wouldn't activating some caching rules inside the gateway do the trick?

Related

How to use Azure App Services domain for Static Web Apps?

I have an Azure App Services instance, which by default goes to https://myappservice.azurewebsites.net (not actually mine, but it's the same format). It's not a bad domain and a lot better than the sporadic randomized domains from Static Web Apps (https://lively-tree-randomletters.azurestaticapps.net).
Is there any way to switch the serverless website running on static web apps to also use the https://myappservice.azurewebsites.net domain?
Or is the only possible solution for hosting (1) react and (2) spring boot on the same domain, to buy one? Or this isn't possible at all?
(I want them to be on the same domain so I don't need to worry about CORS)
I think you could pull this off by using an Application Gateway. With the Application Gateway you can set up path-based rules so that you've got both your app service and your static website, but say yoursite.com/sprintBoot will be routed to your App Service and everything else on yoursite.com, to your static website.
See this article as an example: Create an application gateway with path-based routing rules using the Azure portal
Though it is up for debate if this is easier than worrying about CORS.

Load Balancing in Azure - Subdomains AND SignalR

I am creating a standard multi-tenant site that has the following structure:
example.com
tenant1.example.com
tenant2.example.com
The hosting is Azure web apps. Tenants are generated dynamically (there could be many) and the site includes real-time components, so utilises Azure SignalR. The site will have a wildcard SSL/TLS certificate to enable the subdomain structure.
Rather than going direct to the app service in one region, I'd like to put a load balancer in front of this and route traffic to regional clusters, or maybe even isolated instances for larger clients. It would also be good to have the DDOS protection that comes in-built with these things.
Azure Front Door was my first investigation, this can handle wildcard certificates but doesn't support SignalR.
Application Gateway was my next investigation, this can handle SignalR, but doesn't support wilcard certificates.
In terms of DDOS attacks, it seems we can enable a form of protection directly on the web apps. However, to me, this seems like it would throttle an attack rather than provide (low-cost) protection, as I believe a load balancer would.
How can I load balance this situation please?

What are the benefits of Azure Static Website Hosting over Azure CDN

Just read this article about Static website hosting in Azure Storage :
https://learn.microsoft.com/en-gb/azure/storage/blobs/storage-blob-static-website.
For the moment, I use to deploy my static content to Azure CDN.
So far here are the difference that I've found:
Network performance
Pricing
Custom 404 page (Azure Static Website Hosting)
Custom DNS is only supported for Azure CDN ???
I am wondering what could be a good candidate for Static website hosting in Azure Storage:
Content for local application that does not need to scale globally ?
As the official said, the benefits of using Azure CDN to deliver web site assets include:
Better performance and improved user experience for end users, especially when using applications in which multiple round-trips are required to load content.
Large scaling to better handle instantaneous high loads, such as the start of a product launch event.
Distribution of user requests and serving of content directly from edge servers so that less traffic is sent to the origin server.
I don't think that host Static website in Azure Storage is a good candidate because of the performance. Below points show the features of CDN which are what Azure Storage do not have:
CDN is a content distribution network built on the network. It relies on the edge servers deployed everywhere, through the load balancing, content distribution, scheduling and other functional modules of the central platform, so that users can get the required content near the network, reduce network congestion, improve the user's access response speed and hit rate. The key technologies of CDN include content storage and distribution technology.
The basic principle of CDN is that various caching servers are widely used to distribute the caching servers to areas or networks which are relatively centralized by users. When users access the web site, the user's access is directed to the nearest working normal cache server using the global load technology, and the cache server is used directly. The household request.
Content distribution network (CDN) is a new network construction method, which is specially optimized for the distribution of broadband media in traditional IP networks, and from a broad sense, CDN represents a network service model based on quality and order.
Simply speaking, content distribution network (CDN) is a strategic deployment of the overall system, including distributed storage, load balancing, network request redirection and content management 4 elements, and content management and the global network traffic management (Traffic Management) is the core of the CDN. Through the judgement of user proximity and server load, CDN ensures that the content provides services for users' requests in a highly efficient way.
In general, content services are based on caching servers, also known as proxy caches (Surrogate), which are located on the edge of the network and are only "one hop" (Single Hop) away from the user. At the same time, proxy caching is a transparent image of the content provider source server (usually located in the data center of the CDN service provider). Such an architecture allows CDN service providers to represent their customers, the content providers, to provide the best possible experience to the end users, which can not tolerate any delay in the response time of the request.
More information about CDN, we can refer to: Content Delivery Network and its Business Benefits
In addition, custom DNS is not only for CDN: Setting up Custom DNS Records to point to Azure Web Sites - with Stefan Schackow

Azure Application Gateway with Service Fabric

Currently I have a Service Fabric cluster with 2 stateless services hosting Asp Web APIs. While creating the cluster also appropriate Azure Load Balancers got created.
Now I would like to add Application Gateway in front of my cluster for various reasons like SSL offloading, url-routing etc.
I'd like to understand how to configure the Application Gateway correctly. I see 2 options, not sure which one is valid:
Application Gateway replaces the existing Load Balancer and points directly to SF services hosting WebApi
I keep existing LB configuration and Application Gateway points to this LB (seems like 1 LB solution too many)
Which one is correct? Any advise how to configure?
Approach 2 is what we are using, We have kept the load balancer and that is routing any request received from the Application Gateway. We found this to be easiest and simplest choice, as this involves minimum changes to be done in Application Gateway.
Your two web api's can run on every node in the VM scale set. The Azure Load Balancer is used to distribute traffic over those nodes. Targeting a single service on a single node will reduce scalability and fault tolerance.
You could use the App Gateway to translate incoming request to different ports on the Load Balancer. (E.g. direct traffic to API 1 #url ~/1/ and API 2 #url ~/2/)
Favor using load balancing rules (using all nodes) over NAT redirections (to single nodes). This way you'll have a performant, reliable system.
Solution 2 would also provide possibly to create VPN connection e.g to manage your cluster. Then no need to expose management endpoint to the public. Internal lb also brings on additional features to utilize in the future.
I would go with your first option and to implement it create / modify your ARM template so that it doesn't contain the load balancer and instead contains the application gateway.
Here is a link to the quick starts for ARM templates which you can use. There isn't an out of the box example for service fabric with a gateway but it will give you a great starting place.
link

Traffic manager with multiple endpoints in same location

I'm trying to add web app endpoints from the same location, to an azure traffic manager, when I try to do this, it tells me that App Service will use load balancing to do this for me, when we apps are in the same location.
My understanding is that load balancing is for distributing requests between multiple VMs on one web app. The plan was to use out single DNS and allow traffic manager to determine which endpoint to go to using round-robin or failover. How will load balancing know to direct to one of the web apps from this single address?
Azure Web Apps already have built in load balancing between instances within the web app. So for example if you have a web app with 10 instances under the endpoint: tester.azurewebsites.net, Azure load balances appropriately across those instances.
When you bring in traffic manager, that is looking for different endpoints to facilitate between. Incoming requests will be routed based on proximity to endpoints it is managing, load and if the endpoint is available. Traffic Manager takes care of all of those complexities for you.
This allows you to have a single endpoint myapp.azurewebsites.net; which may route to myapp-west.azurewebsites.net and myapp-east.azurewebsites.net. That routing as I indicated is based on proximity, load and availability.
How it actually works is the magic sauce of Azure Traffic Manager. I use it in production and it has been working very well for me. I primarily use it for routing based on proximity, and have yet to experience a failure on a web app to test a production failover reroute.
Hope that helps!

Resources