Creating dynamic rules for static Websites with Azion Edge Application

Edit on GitHub

Edge Application is a service that allows the customer to build their web applications to run on Azion’s Edge Computing platform. It provides a set of resources and functionality, such as Edge Caching, Edge Functions and Network for creating business rules at the edge, for handling Cookies, Redirects, Match groups, A / B Tests and other functions.

This way, you can implement dynamic rules on static pages that will be processed and delivered directly to our Edge Nodes. Landing pages, error pages, institutional or campaign websites are some examples of pages that can be created using this approach.

Some of the other advantages from using the Edge Application service are:

  • Gives the client flexibility when developing applications;
  • You can look up information on accesses in real time (Real Time Events); and
  • Combine security logic systems to manage availability, bot mitigation and authentication, through the Edge Firewall service.

How it works

When an Edge Application is set up for your website, Azion is responsible for delivering the content and processing the business rules. Therefore, when a request to the website reaches any of Azion’s Edge Nodes, the Edge Application rules engine handles the request and delivers the content based on the settings.

First, you need to define the Origin for the website (local infrastructure or cloud storage service), where Edge Application will go to, to check the files.

Next, configure the business rules required, using the available modules:

  • Application Acceleration: accelerates the performance of applications and APIs by optimizing protocols and building advanced request and response rules;
  • Edge Caching: a standard module for all of your Edge Applications in Azion. Reduces latency and has a high transfer rate, using Azion’s global and highly distributed Edge network;
  • Edge Functions: a module that allows the customer to program their own Edge Functions to be run on Azion’s Edge;
  • Image Processor: automates the processing of images in the workflow, allowing you to resize, crop and apply filters to large quantities of images;
  • Load Balancer: a module that allows you to balance the traffic going to the origin servers.

Finally, in order for the Edge Website to be accessed by users, a Domain needs to be created and linked to the Edge Application.

How are Azion Websites Published?

Our portal (https://www.azion.com) is published through an automated integration process with GitHub, basically composed of three elements: a repository on GitHub to control the version of the website, a repository (Origin) in cloud storage and an Edge Application at Azion executing all the business and security rules.

The contents of the website are published automatically through GitHub, which in turn propagates the changes to the file bucket, which is configured within an Azion Edge Application. This way, when any page of the website is accessed, the Edge Application handles the request and delivers the requested content.

The following is an example of how an Edge Website is configured with Azion’s Edge Application.

Configuring an Edge Application

Path: Real-Time Manager > Edge Computing > Edge Applications

In Real-Time Manager (RTM), access the Edge Application menu, click on the “Add Application” button, enter an identifiable name of your choice and then configure the other settings as follows:

Origin: in the Main Settings section, under Origins, enter the address of your repository in the Address field, and in the Host Header field, type the variable ${host} to define the host header that must be sent to the repository. Complete the rest of the information and click on Save. Note: if the repository requires HMAC authentication, check the “HMAC” option and fill in the additional fields with the data provided by your service provider.

Application Acceleration: the module that enables the necessary Rules Engine settings. On the Main Settings tab, activate the option Application Acceleration and click on Save.

Rules Engine: this is where the validation Criteria and Behaviors that the Edge Application needs to execute are configured. Open the Rules Engine tab and click on “New Rule”, option “Request Phase”, and set the validation criteria and preferred behaviors.

Defining validation criteria: choose the variables, comparison operators and strings to create your business rule, as in the following example:

  • If: ${uri} matches \/$ (In order: logical operator, variable, comparison operator, string)

Here, the rule will be executed for the root page of the website, exclusively (such as https://www.azion.com/).

Defining Behaviors: add the behaviors you want to be carried out when the rule’s conditions are met. For Example:

  • Then: *Rewrite Request * ”${uri}index.html” (In order: logical operator, action, function)

In this example, if the conditions set by the rules are met, then there will be a rewrite of the index page of the website. Click on Save to save your changes.

Configuring a Domain

Path: Real-Time Manager > Edge Computing > Domains

Finally, so that the Edge Website can be accessed by users, you also need to configure a Domain linked to the Edge Application previously created.

Open the Domain menu, click on the “Add Domain” button and enter a name of your choice, so you can identify it. An Azion certificate is selected by default - this is what we will use in our example.

Leave the CNAMEs field blank, select the Edge Application previously created, to link it to the domain, and click Save. Note that a list of registered domains will appear on the next screen. The information contained in the Domain Name column is the name of the domain created by Azion (along the lines of 12345t.ha.azioncdn.net), and the test Edge Website will be accessed through this.


Didn’t find what you were looking for? Open a support ticket.