ALB Extensible Edition supports forwarding requests to FQDN-type backend services. You can use OSS to store static resources, and an ALB Extensible Edition instance routes requests to OSS through a VPC. This architecture separates your frontend and backend, reduces public network traffic costs, and improves access stability.
How it works
The ALB Extensible Edition instance receives client requests and forwards them through the VPC to the OSS bucket access domain configured in the FQDN-type server group. The instance then returns the bucket's response to the client. To handle other types of requests, add more backend services and configure forwarding rules as needed.
-
ALB Extensible Edition instance: Provides load balancing and traffic forwarding capabilities.
-
HTTPS listener: Receives client requests.
-
FQDN-type server group: Defines the OSS bucket's access domain as a backend service.
-
OSS bucket: Stores static website resources.
Prerequisites
-
You have access to the public preview of ALB Extensible Edition.
-
You have created a VPC in the China (Ulanqab) region, with one vSwitch in Zone A and another vSwitch in Zone B.
-
You have registered a custom domain name and completed the ICP filing for it. In this solution, both the OSS bucket and the ALB instance are deployed in the China (Ulanqab) region. Therefore, both the domain name mapped to the OSS bucket and the domain name that clients use to access the ALB instance must complete ICP filing before they can be used.
-
You have an SSL certificate that matches your custom domain name. If the certificate was not purchased from Alibaba Cloud, you must upload it to Alibaba Cloud Certificate Management Service.
Procedure
Step 1: Create and configure an OSS bucket
Create an OSS bucket, configure public read permissions, upload your static page files, and enable the static website hosting feature.
Create an OSS bucket
-
Log on to the OSS Management Console. In the left navigation bar, click Bucket List, and then click Create Bucket.
-
In the Create Bucket panel, configure the following settings and keep the default values for the other settings. Click Create and confirm.
-
Bucket Name: Set a globally unique name for the bucket.
-
Region: Select China (Ulanqab).
-
Configure bucket permissions
-
In the Bucket list, click the target Bucket Name to open the Bucket details page.
-
In the left navigation bar, click Permission Control > Block Public Access, turn off the Block Public Access switch, and then confirm the action in the dialog box that appears.
-
Switch to the ACL tab, click Settings, set Bucket ACL to Public Read, and then click Save.
Upload static page files
-
In the left navigation bar, click Object Management > Objects, and then click Upload Object.
-
Upload the sample static webpage
index.html. For Object ACL, select Inherit Bucket.
<html>
<head>
<title>Hello OSS!</title>
<meta charset="utf-8">
</head>
<body>
<p>Start Alibaba Cloud OSS Hosting</p>
<p>This is the index page</p>
</body>
</html>
-
Continue to upload the
404.htmlfile. For Object ACL, select Inherit Bucket.
<html>
<head>
<title>Page Not Found</title>
<meta charset="utf-8">
</head>
<body>
<p>The page you are looking for does not exist</p>
<p>You can try visiting the homepage</p>
</body>
</html>
Configure static website hosting
In the left navigation bar, click Data Management > Static Page, and then click Settings. After you complete the configuration, click Save.
-
Default Homepage: Enter
index.html. -
Subfolder Homepage: Disabled by default.
-
Default 404 Page: Enter
404.html. -
Error Page Status Code: Default 404.
Step 2: Map a domain to the OSS bucket
When you access an HTML file using a bucket's default domain name (either an internal or public domain name), OSS adds response headers that force the browser to download the file instead of rendering it. To bypass this security restriction, you must map a custom domain name to the bucket.
-
In the left navigation bar, click Bucket Settings > Domain Names, and then click Map Custom Domain Name.
-
In the Map Custom Domain Name dialog box, enter the domain name to bind to the OSS bucket, follow the prompts to complete the binding, and confirm that the domain has taken effect.
After the binding is complete, record the bound domain name (for example, static.example.com). You will use this domain name to configure the ALB backend service in the following steps.
Step 3: Create an ALB Extensible Edition instance
-
Log on to the ALB console, and click Create ALB.
-
On the purchase page, complete the following configurations, and click Create Now.
-
Region: Select China (Ulanqab).
-
Network type: Select Internet.
-
VPC and Zone: Select the target VPC. For the zones, select Ulanqab Zone A and Ulanqab Zone B and a corresponding vSwitch for each. Finally, select Automatically assign EIP.
-
IP version: Select IPv4.
-
Edition: Select Extensible.
-
-
On the Confirm Order page, confirm the instance configuration details, and click Activate Now.
Step 4: Configure PrivateZone resolution
Configure PrivateZone to resolve the custom domain name that you mapped to the OSS bucket in Step 2 to the bucket's internal domain name. This allows ALB to access the bucket through the VPC, which reduces public traffic costs and improves access stability.
Add a zone to PrivateZone
-
Log on to the Private DNS console, and click Add Zone.
-
In the Add dialog box, configure the following parameters and click OK to confirm.
-
Authoritative Zone: Enter the domain name that is bound to the OSS Bucket, such as
static.example.com. -
Effective in VPCs: Select the VPC where the Application Load Balancer (ALB) instance is located.
-
Add a CNAME record
-
In the domain name list, click Settings in the Actions column of the target domain name. On the Settings page, click Add Record.
-
In the Add Record dialog box, complete the following configuration, and click OK.
-
Record Type: Select CNAME.
-
Hostname: Enter
@to resolve to the root domainstatic.example.com. -
Record Value: Enter the internal domain name of the OSS Bucket. On the Overview page of the OSS Bucket, view the value for Access from ECS over the VPC (internal network) in the Bucket Domain Name column. The value is in a format such as
bucket-name.oss-cn-wulanchabu-internal.aliyuncs.com. -
Query Source and TTL: Keep the default values.
-
-
In the Change Resource Record Confirmation dialog box, confirm the record information, and click OK.
After the DNS resolution takes effect, when you access static.example.com from the VPC where the ALB is located, the domain name is resolved to the internal IP address of the OSS bucket, allowing access over the VPC internal network.
Step 5: Create an FQDN-type server group
Create an FQDN-type server group and add the access domain name of the OSS bucket as a backend service.
-
In the Server Group console, make sure that the region is set to China (Ulanqab), and click Create Server Group.
-
Configure the server group based on the following information and click Create.
-
Server Group Type: Select FQDN.
-
Server Group Name: In this topic, enter
sgp-dns-oss. -
Backend Server Protocol: The default value is
HTTP. -
DNS Server Configuration: Click Auto-fill with Private DNS Address. The system automatically fills in the Alibaba Cloud internal DNS.
-
-
In the The server group is created dialog box, click Add Backend Server. In the Add DNS Name dialog box, complete the following configurations and click OK.
-
DNS name: Enter the domain name that is mapped to the OSS bucket, such as
static.example.com. -
Port: Enter
80.
-
Step 6: Create a listener
-
In the ALB console, click the target instance ID to go to the Instance Details page. On the Listener tab, click Create Listener.
-
In the Configure Listener step, set Listener Protocol to HTTPS and Listener Port to
443. Then, click Next. -
In the SSL Certificate step, select the SSL certificate that matches your custom domain name, and click Next.
-
In the Server Group step, select the FQDN type and the
sgp-dns-ossserver group, and then click Next. -
In the Configuration Review step, confirm the configuration and click Submit.
Step 7: Configure DNS resolution
Create a CNAME record to point your custom domain name to the DNS name of the ALB instance. This allows clients to access your website through the custom domain.
This tutorial uses Alibaba Cloud DNS as an example. If your domain name is not registered with Alibaba Cloud, you must first add your domain name to the Alibaba Cloud DNS console.
-
Go to the ALB console and copy the Domain Name of the target instance.
-
Log on to the Alibaba Cloud DNS console, and in the Actions column of the target domain name, click Settings. On the Settings page, click Add Record.
-
Add a CNAME record based on the following information and click OK.
-
Record Type: Select CNAME.
-
Hostname: Enter a domain name prefix, such as
test. The domain name for accessing the ALB istest.example.com. -
Query Source and TTL: Keep the default settings.
-
Record Value: Enter the DNS name of the ALB instance.
-
-
In the Change Resource Record Confirmation dialog box, confirm the DNS record information, and click OK.
Step 8: Test and verify
test.example.com is an example domain name. For testing, replace it with the actual domain name that you configured in Step 7. You must ensure that the domain name resolution has taken effect.
Access the homepage
Visit https://test.example.com in a browser, and the default homepage index.html that is configured in OSS is returned.
Directly access index.html
Accessing https://test.example.com/index.html in a browser also returns index.html.
Test the 404 error page
Accessing a non-existent resource in a browser, such as https://test.example.com/donotexist, returns the 404.html error page configured in OSS.
More information
Billing
-
OSS fees: Billed based on actual usage. For more information, see OSS billing overview.
-
ALB Extensible Edition: This feature is in public preview and is free to use. However, you are billed separately for the EIP bound to the ALB Extensible Edition instance. For more information, see EIP billing rules.
-
PrivateZone resolution fees: Billed on a pay-as-you-go basis. For more information, see PrivateZone product billing.
-
Domain name and public DNS resolution fees: In addition to the domain name fees charged by your registrar, you must pay public authoritative DNS resolution fees if you use Alibaba Cloud DNS for public resolution.
-
Certificate fees: If you purchase a certificate from or upload a certificate to Alibaba Cloud, you must pay SSL certificate fees.
Supported regions for ALB Extensible Edition
Area | Region | Zone |
China | China (Ulanqab) | Zone A, Zone B, and Zone C |
China (Hangzhou) | Zone J and Zone K | |
China (Beijing) | Zone I, Zone K, and Zone L | |
China (Shanghai) | Zone B and Zone F | |
China (Hong Kong) | Zone B, Zone C, and Zone D | |
Asia-Pacific | Singapore | Zone A, Zone B, and Zone C |
Japan (Tokyo) | Zone B, Zone C, and Zone E | |
Malaysia (Kuala Lumpur) | Zone A, Zone B, and Zone C | |
Europe and Americas | Germany (Frankfurt) | Zone A and Zone B |
US (Silicon Valley) | Zone A and Zone B | |
Middle East | UAE (Dubai) | Zone A and Zone B |
Recommendations
-
Bucket type selection: Choose a suitable storage class based on access frequency to balance performance and cost. For important static resources, enable zone-redundant storage to ensure higher availability.
-
CDN acceleration: Place a CDN in front of ALB to cache static resources on edge nodes. This improves access speed and the user experience.
FAQ
Request fails to reach OSS with the error: upstream connect error or disconnect/reset before headers. reset reason: connection timeout
-
Verify that PrivateZone resolution is correctly configured and that the PrivateZone is associated with the ALB instance's VPC.
-
Verify that the domain name configured in the server group matches the domain name mapped to the OSS bucket.
Request reaches OSS, but homepage is not shown
-
Verify that the bucket allows public access and that its ACL is set to public read.
-
Ensure that static website hosting is enabled for the bucket, and the
index.htmlfile is uploaded and set as the default homepage.