Applications quickstart
Create an Application that sends every request to your origin through a Connector, serve it from a Workload, and request it.
This guide instructs you through serving your origin’s content from your first Application.
- Create a Connector that reaches your origin over HTTPS.
- Create an Application.
- Add a rule that sends every request to the Connector.
- Serve the Application from a Workload.
- Send a request to the workload domain and get your origin’s answer.
Five parts make the chain, listed in the order this guide uses them:
- The Connector holds the address of your origin and the way Azion connects to it.
- The Application holds the rules that decide what happens to a request. A new Application has no rules.
- The rule on the Application pairs a condition on the request, called a criterion, with an action called a behavior. In this guide, the criterion matches every request, and the Set Connector behavior sends the request to the Connector.
- The Workload holds a domain and receives the requests sent to it. Its deployment, a setting of the Workload, sets the Application that receives those requests.
- The request goes to the workload domain, the hostname Azion assigns to the Workload. The rule of the Application matches the request, and the Connector routes it to your origin.
A Connector receives requests only once a rule sets it, and an Application only once a deployment sets it.
Each Application has four switches: Cache, Functions, Application Accelerator, and Image Processor. In Azion Console, the switches are in Main Settings > Modules, and in the API, they are the keys of modules. A new Application starts with Cache and Functions turned on and the other two turned off, and this guide keeps all four as they are. The quickstarts of Cache, Application Accelerator, and Image Processor begin where this guide ends, with an Application that already serves content.
Prerequisites
Console
- An Azion account. For more information, refer to Create an account.
- An origin server that answers HTTPS requests on port
443under a public hostname. This guide writes that hostname as<your-origin-hostname>. curl, to send a request through the Workload.- Access to Azion Console. For more information, refer to Access Azion Console.
Create a Connector to your origin
A Connector holds the address of your origin and the settings Azion uses to reach it. You create it on its own, outside any Application, and a rule sets it later. This Connector has one address and connects to your origin over HTTPS. It sends your origin’s hostname in the Host header.
By default, a Connector sends the host the client requested, which here is your workload domain. An origin that routes by name may not answer that host. For more information, refer to Host header.
Console
To create the Connector in Azion Console:
Access Azion Console > Connectors.
Select + Connectors.
In General, enter origin-connector as the Name.
In Connector Type, keep HTTP selected.
Under Address Management, enter <your-origin-hostname> in Address, without a protocol or a port.
In Connection Options, replace ${host} in Host with <your-origin-hostname>, the same value as Address.
In Transport Protocol Policy, select Force HTTPS.
Azion Console shows the message “Connector successfully created”. The Connector exists in your account, and the rule you add to the Application selects it. For every field of the Connector form, refer to Connector settings.
Create the Application
An Application holds the rules that decide what happens to each request. It needs only a name, and every other setting keeps its default. The Application reaches your origin only through a rule that sets a Connector.
Console
To create the Application in Azion Console:
Access Azion Console > Applications.
Select + Application.
In General, enter first-application as the Name.
The Application exists, and its Rules Engine tab holds no rules yet.
Send every request to the Connector
A rule in Rules Engine for Applications pairs criteria with behaviors. This rule runs in the Request Phase. Its criterion, ${uri} starting with /, matches every request. Its behavior, Set Connector, sends each matching request to your Connector. For more information, refer to Set Connector.
The criterion uses ${uri}, not ${request_uri}. ${request_uri} needs Application Accelerator turned on. On an Application with Application Accelerator turned off, the API refuses the rule with 400 and error 25047, Missing Required Modules.
Console
To create the rule in Azion Console:
Access Azion Console > Applications, and select the Application you created.
In General, enter send-to-origin as the Name.
In Phase, select Request Phase. A rule’s phase cannot change after you create the rule.
Under Criteria, keep ${uri} and starts with, and enter / as the argument.
Under Behaviors, select Set Connector.
In the list of the Set Connector behavior, select origin-connector.
The rule appears in the Rules Engine tab, under the Request heading.
Serve the Application from a Workload
A Workload receives the requests sent to its domains. It holds those domains, the protocols, and the certificates, so you configure delivery on the Workload, not on the Application. The Workload’s deployment sets the Application that receives those requests, and a Workload holds one deployment. A new Workload answers on a workload domain that Azion assigns under map.azionedge.net.
Console
To create the Workload and its deployment in Azion Console:
Access Azion Console > Workloads.
Select + Workload. The Create Workload page opens.
Enter a name, such as first-workload.
Under Deployment Settings, set Application to the Application you created.
The Workload exists, and its deployment sets your Application. To copy the address that the final request goes to, select Copy Workload URL in the message that Azion Console shows. The message closes after a few seconds, and the Workload Domain column of the Workloads list also shows the address.
Send a request through the Workload
This stage needs only curl, whichever interface you used to build the chain. In the command, replace <your-workload-domain> with the workload domain of the Workload you created.
A new Workload answers with your origin’s response only after its first deployment reaches traffic. This can take several minutes, and Azion guarantees no duration. Until then, the workload domain answers 404 with a placeholder page. While the deployment spreads, answers to the same request can alternate between that 404 and your origin’s response. Repeat the request until the answer comes from your origin. For more information, refer to Propagation.
Send a request to the root path of your workload domain:
The response is the one your origin returns for /: its status, its headers, and its body. Every other path reaches your origin the same way, because the rule matches every URI that starts with /. Your Application now sends every request on the workload domain to your origin through the Connector.
When your origin refuses the TLS handshake, the response is a 502 with the page titled Azion - Default error page, not a page from your origin. For more information, refer to Connection reuse and timeouts.