How to define a new origin for your application
Define an origin to determine the source of the content of your application. It can be an application, a web server, or a storage.
When you create an edge application, a default origin is created and activated automatically. This guide will show you how to create and activate a new origin with different configurations without removing or editing the default origin.
- Access Azion Console > Edge Application.
- Click the edge application for which you want to configure a new origin.
- Select the Origins tab.
- Click the + Origin button.
- Give your new origin a name. For example:
httpbin.org
- Under Type, keep the option Single Origin selected.
- Under Protocol Policy, select Enforce HTTPS.
- Under Address, add
httpbin.org
- Under Host Header, add
customhost.com
. - Leave Path blank.
- Click the Save button.
You’ve created a new origin, but it isn’t active in your application yet. You need to define what will trigger a request to the new origin.
- Navigate to the Rules Engine tab.
- Click the + Rule button.
- Give a name for your rule.
- Select Request Phase.
- Under the Criteria section, select the variable
${uri}
.
- As a comparison operator, select is equal.
- As an argument, add
/httpbin
. - In the Behaviors section, select Set Origin from the behavior list.
- Select the new origin you created.
- Click the Save button.
- Wait a few minutes for the changes to propagate and access
xxxxxxxxxx.map.azionedge.net/httpbin
.
- Access Real-Time Manager.
- On the upper-left corner of the page, open the Products menu, represented by three horizontal lines, and then select Edge Application.
- Click the edge application for which you want to configure a new origin.
- Select the Origins tab.
- Click the Add Origin button.
- Give your new origin a name. For example:
httpbin.org
- Under Origin Type, keep the option Single Origin selected.
- Under Host Header, add
customhost.com
. - Leave Origin Path blank.
- Under Origin Protocol Policy, select Enforce HTTPS.
- Under Address, add
httpbin.org
. - Click the Save button.
You’ve created a new origin, but it isn’t active in your application yet. You need to define what will trigger a request to the new origin.
- Navigate to the Rules Engine tab.
- Click the Add Rule button and select Request Phase.
- Under the Criteria section, select the variable
${uri}
.
- As a comparison operator, select is equal.
- As an argument, add
/httpbin
. - In the Behaviors section, select Set Origin from the behavior list.
- Select the new origin you created.
- Click the Save button.
- Wait a few minutes for the changes to propagate and access
xxxxxxxxxx.map.azionedge.net/httpbin
.
- Run the following
POST
request in your terminal, replacing[TOKEN VALUE]
with your personal token and the<edge_application_id>
variable with your edge application ID:
Key | Description |
---|---|
name | Sets the string in value as a name of the origin. |
origin_type | Sets the new origin type to single_origin . For more information on load balancing, check Work with multiple origins. |
addresses | Takes a list of objects for each address of the origin. Since this is an entry of the single origin type, you may only send one object with the address value in the array. |
origin_protocol_policy | When https , enforces an HTTPS connection with the origin, not affecting the protocol from user requests. |
host_header | Sets the string in value as the value of the Host header sent to the origin. |
- You’ll receive a response similar to this:
- Run the following
POST
request in your terminal, replacing[TOKEN VALUE]
with your personal token, the<edge_application_id>
variable with your edge application ID, and the<origin_id>
variable with the origin ID from when you created a new origin via API:
- You’ll receive a response confirming that the rule was created.
- Wait a few minutes for the changes to propagate and access
xxxxxxxxxx.map.azionedge.net/httpbin
. Also, try accessing any other unconfigured URI: you should receive a404
error.