How to configure HTTP and HTTPS ports for origins and delivery address

With Azion Edge Application, you can customize your application’s delivery address ports as well as from which ports of your origin address your content is retrieved. This dual customization provides complete control over how your content is fetched from origin and delivered to your users for both HTTP and HTTPS protocols.

The choice of delivery ports are limited to those supported by Azion. However, for origins of the Single Origin or Load Balancer types, you can retrieve your content from the appropriate origin port, as long as the port exists.


Available port combinations

There are several port combinations you can configure for your application.

Use caseExample origin URLExample delivery URL
Application served from default origin ports to default delivery portshttps://origin.com:443https://delivery.com:443
Application served from a default origin port to a different protocol of a default delivery porthttp://origin.com:80https://delivery.com:443
Application served from a default origin port to a custom delivery porthttp://origin.com:80http://delivery.com:8080
Application served from a custom origin port to a default delivery porthttps://origin.com:9443https://delivery.com:443
Application served from a custom origin port to a custom delivery porthttps://origin.com:8443https://delivery.com:9443

Configuring ports

To configure your application’s origin and delivery ports:

  1. Access Azion Console > Edge Application.
  2. Select the edge application you want to configure.
  3. Check the solutions for each use case below.

Default origin port to default application port

If you want your content to be drawn from a default port and served in a default application port, configure your edge application as follows:

  1. In the Origins tab, select the default origin or add a new origin.
  2. Fill in the required fields.
  3. Keep the option Preserve HTTP/HTTPS protocol selected.
  4. In Address, type the hostname of your origin. Example: yourorigin.com.
  5. Click the Save button.
  6. In the Main Settings tab of your edge application, select one of the default HTTP or HTTPS ports. Example: 80.
  • If you determine your application is delivered via HTTP only, you’ll only be able to select port 80. Enabling both HTTP and HTTPS will enable the HTTPS port 443.
  1. Click the Save button.

With this option enabled, access to your application through default ports will be through the default ports of your origin.

Modified default origin port to default application port

You can modify the default port your application’s origin by enforcing protocols. For example, you can determine that your application will be delivered in HTTPS but the communication with origin servers should be made exclusively in HTTP. To do so, configure your application as follows:

  1. In the Origins tab, select the default origin or add a new origin.
  2. Fill in the required fields.
  3. In the section Protocol Policy, select Enforce HTTP if you want the edge to access your content explicitly through HTTP.
  4. Click the Save button.
  5. In the Main Settings tab of your edge application, select one of the default HTTP and HTTPS ports. Example: 80 and 443.
  6. Click the Save button.

Custom origin port to default application port

You can use the host:port notation to specify the port from which your content will be retrieved and deliver it through a default application port. In this case, your content will be retrieved from a custom port of your origin and delivered through the default port you selected. To do so:

  1. In the Origins tab, select the default origin or add a new origin.
  2. Fill in the required fields.
  3. Keep the option Preserve HTTP/HTTPS protocol enabled.
  4. In Address, type the hostname of your origin and add the port notation with the custom port. Example: yourorigin.com:8080.
  5. Click the Save button.
  6. In the Main Settings tab of your edge application, select one of the default HTTP or HTTPS ports. Example: 443.
  7. Click the Save button.

Default origin port to custom application port

To deliver your content from a default origin port to a custom application port:

  1. In the Origins tab, select the default origin or add a new origin.
  2. Fill in the required fields.
  3. Keep the option Preserve HTTP/HTTPS protocol enabled.
  4. In Address, type the hostname of your origin. Example: yourorigin.com.
  5. Click the Save button.
  6. In the Main Settings tab of your edge application, select one of the custom HTTP or HTTPS ports. Example: 9443.
  7. Click the Save button.

Custom origin port to custom application port

If you want requests to be directed to an origin only using custom ports, you must specify that requests to your application made from the custom port are directed to the correct port. To do so:

  1. On the Main Settings tab, under HTTP Ports, check which custom ports have been selected.
  2. Go to the Origins tab.
  3. Click the + Origin button.
  4. Give your origin an easy-to-remember name. Example: Origin:8080.
  5. Fill in the required fields.
  6. Keep the option Preserve HTTP/HTTPS protocol enabled.
  7. In Address, use the host:port notation. Example: yourorigin.com:8080.
  8. Fill in the remaining fields with the desired values.
  9. Click the Save button.

Now you need to configure your application so that when requests are received in custom ports, they’re redirected to the correct origin port:

  1. Go to the Rules Engine tab of the edge application.
  2. Click the + Rule button.
  3. Give your rule an easy-to-remember name. Example: Set Origin :8080.
  4. Select Request Phase.
  5. Under the section Criteria, select the variable ${server_port}.
  6. For a comparison operator, select is equal to.
  7. As an argument, add the desired port. Example: 8080.
  8. In the Behaviors section, select the behavior Set Origin.
  9. Select the origin created in the previous instructions.
  10. Click the Save button.

If more than one custom port was selected for the application, you may create additional rules, repeating the previous steps for each custom port selected.

From this moment on, when a request is made to the edge application using a custom port, the edge points the request to the assigned port when accessing the origin.


Contributors