Configuring the Massive Redirect function for Domain Migration

The Massive Redirect edge function is a serverless integration available at Azion Marketplace. It’s designed to handle a large number of redirects and can be used when a large number of addresses need to be changed, for example, when migrating domains.

By centralizing the management of multiple settings in one place, this application allows you to control redirects directly at the edge. In this way, you can handle different situations such as CMS or e-commerce platform migrations, or website updates.

Some of the other benefits of using the Massive Redirect integration for domain migration include:

  1. Managing multiple redirects centrally. There’s no need to create a request phase rule for each redirect.
  2. Reducing negative SEO impact.
  3. Reducing search engine ranking risk for the affected pages.
  4. Enabling processing at the edge, offloading resources from the source infrastructure.

The function deals with the redirection of traffic according to the settings specified by the Args parameters and the validation criteria defined in the Rules Engine of Edge Application.

When a request to an address, configured in the parameters, reaches any of the Azion’s edge nodes, the function identifies that it needs redirection. Then, it redirects the request to the new address. The originating application receives the request and returns the content for the edge node to send to the user with the appropriate HTTP status—301 or 302, depending on the configuration.

The redirecting that the function needs to perform is defined by using a list of parameters in JSON, consisting of pairs containing the old address and the destination address (Args), as shown next:

  • old address: this can be listed exactly or by using a regular expression from the options below:
    • from: full address.
    • from_regex: regular expression to represent a standard URL format, allowing you to configure more than one address using a single rule. These expressions must be in the form of Perl Compatible Regular Expressions (PCRE) patterns.
  • destination address: can be written in two ways:
    • moved: destination (URL) that will be permanently redirected (HTTP status 301).
    • found: destination (URL) that will be temporarily redirected (HTTP status 302).

Therefore, the configuration of a list of redirects would have the following format:

[{
"from": "https://www.old-site.com/",
"moved": "https://www.new-site.com"
},
{
"from": "https://www.old-site.com/shoes-snekears.html",
"moved": "https://www.new-site.com/category/shoes/sneakers"
},
{
"from": "https://www.old-site.com/users-login.html",
"found": "https://www.new-site.com/login.html"
},
{
"from_regex": "https://(api|store|checkout)\\.old-site\\.com$",
"moved": "https://www.new-site.com/%1$"
}]

List with multiple redirects in a single Args configuration

Section titled List with multiple redirects in a single Args configuration

Based on the information contained in the Args, the function will carry out an interpretation of addresses and redirects, as it’s explained in detail next.

Configuring the Massive Redirect function

Section titled Configuring the Massive Redirect function

The edge function Massive Redirect is available on Azion Marketplace and can be accessed through Real-Time Manager (RTM), on the Products menu on the upper-left corner, represented by three horizontal lines.

The function can only be executed when it has been instanced in the edge application that you intend to work in, and when the activation criteria and behaviors have been defined in the Rules Engine.


To create a Massive Redirect function, you can refer to the guide on How to install the Massive Redirect from Azion Marketplace.


Defining the Execution criteria on Rules Engine

Section titled Defining the Execution criteria on Rules Engine

The rules (Rules Engine) determine the set of conditions that need to be met for behaviors to be executed. You can either use the Default Rule or create a new one to set the parameters for validating and the behaviors that the edge application will execute.

Defining the validation criteria (criteria)

Section titled Defining the validation criteria (criteria)

Choose the variables, comparison operators, and strings to create your business rule, as in the example below:

if: ${domain} is equal old-site.com

Logic: logical operator, variable, comparison operator, string.

In this example, if the domain accessed is the same as the string old-site.com, the rule will be executed.

Defining behaviors (behaviors)

Section titled Defining behaviors (behaviors)

Add the behaviors you want to be carried out when the rule’s conditions are met, as in the example below:

Then Run Function and chose MyMassiveRedirect, or any other name you gave it.

Logic: logical operator, action, function.

In this example, if the conditions defined in the rules are satisfied, then the function MyMassiveRedirect will be executed.

Finally, save your configurations and your edge application will be ready to run this new function.


Contributors