Azure CDN & Azure FrontDoor

Suthesana
4 min readAug 16, 2020

--

Azure FrontDoor

Typically, once we deploy our web applications to Azure App Service or other clouds, the network flow of a user visiting our site is extremely simple , the user’s computer just send the request on to our server and obtain the response, this may have some potential issues.

First, the access speed. for instance , my blog is deployed in South Asia, this makes users within the UK visiting my site to possess much slower speed than users in Sri Lanka. Even if you have already added Azure CDN to enhance the performance, but CDN can’t solve everything. Data centers which physically near the end-user certainly have an enormous advantage in access speed. This is often one among Azure Front Door’s capability to automatically select the foremost nearby data center that runs your workload for the user.

Second, it’s about resilient. When your web site goes down in a data center, or the data center itself goes down. Azure Front Door can detect the failure and automatically routes your users to the next nearby data center within minutes. The user will only notice a slower access speed instead of see your website blow up in front of the screen.

Another problem is security. Hackers and automated scripts can scan your site for security holes like SQL injection, XSS and try to attack your site. The WAF comes with Azure Front Door can identify and stop these attacks, including request rate limit or block a region/country’s entire IP address from accessing your site.

Let’s create the front door..

Go to the Azure portal and search for Azure Front door. Select Front Door and click Add.

Select resource group and click next configuration.

After Basic, we should fill this three sections in the configuration.

  • Frontend/domains- We should provide frontdoor URL to access the front door.In here you have to create frontend which is end point to your backend application.
  • Backend pools- Resources locations should be mentioned here. It can be either web apps,Cloud service, Storage, etc.
  • Routing rules- We should set the rule to bind frontend URL with backend URL with configurable manner.

Now configure Frontend.

If you need firewall for you can enable if you need. Then click Add.

Next configure backend now.

If you click Add a backend you can add backend to Front Door. In my case i have only one backend end point to connect.

Now click “Add” to end up adding backend pool.

lets Add routing rules next.

Select the Route Type as Redirect. Replace the destination host with your backend host name and destination path with your api path.

Click on review and create.Now we have created our Front Door successfully. Now we can use Frontend url in my case “productsFront.azurefd.net” as endpoint for the Angular application that we had deployed before.

You can also update the Front Door with routing rules and backend pool in portal later. Now my end point to the backend is productsFront.azurefd.net/api/v1/products.

Azure CDN

Content Delivery Network (CDN) is a distributed computing model designed for developers to stream high-bandwidth files faster,reliably and efficiently to worldwide users. Azure CDN is usually used for delivering static content like Videos, Images, Style sheets, files ,documents , Client-side scripts and HTML pages to users using servers that are closest to the users. CDNs store cached content on edge servers in point-of-presence (POP) locations that are close to end users, to reduce the latency.

For the first time your subscription may not allowed to create CDN. So first check your subscription with registered resource providers in the settings section.

You can filter it typing just CDN and check weather its register or unregistered in the list. If cdn is not in the registered list click on register to register CDN.

In my Angular + Spring-boot application project I connect my front-door link to CDN as custom origin.

First you need to create an end point. While creating resource or after create CDN you can create endpoint. This endpoint is used to access the web content. After creating endpoint you should add origin details.

You can add origin on your own preference. In my project I have used custom origin to connect Azure Frontdoor URL.

Now we have successfully integrated the azure CDN to our project .

Next topic:Azure Key vaults

--

--