Configure the network for a Dify instance
AI-Native Database Service allows you to access Dify instances over a VPC network. You can configure VPC connectivity, security group rules, and custom domain names to ensure network security and convenient access for your Dify instances.
Prerequisites
A Dify instance is created. For more information, see Create a Dify instance.
A virtual private cloud (VPC) and a vSwitch are created. For more information, see Create and manage a VPC.
If you want to configure a custom domain name, make sure that the domain name has obtained an ICP filing.
Configure VPC connectivity
A Dify instance is deployed in a VPC. You must associate the instance with a specific VPC and vSwitch to enable internal network communication with other cloud resources in the same VPC.
Log on to the AI-Native Database Service console.
In the left-side navigation pane, click Dify Instance List.
Find the target instance and click the instance ID to go to the instance details page.
In the Network Configuration section, click Modify.
Configure the following VPC network parameters.
Parameter
Description
VPC
Select the VPC to which the Dify instance belongs. We recommend that you select the same VPC as your business application to reduce network latency.
vSwitch
Select a vSwitch in the VPC. The vSwitch determines the zone of the instance. Make sure that the selected zone supports the current instance type.
Private endpoint
The internal endpoint automatically assigned by the system. Cloud resources in the same VPC, such as Elastic Compute Service (ECS) instances, can use this endpoint to access the Dify instance.
Click OK to complete the VPC network configuration.
Modifying the VPC configuration may cause the Dify instance to be briefly unavailable. We recommend that you perform this operation during off-peak hours.
Configure security group rules
A security group acts as a virtual firewall that controls inbound and outbound network traffic for a Dify instance. You must configure appropriate security group rules to ensure network security.
Log on to the AI-Native Database Service console.
On the details page of the target Dify instance, find the Security Group section.
Click the security group ID to go to the security group details page.
Add the following security group rules based on your business requirements.
Direction
Port range
Authorization object
Description
Inbound
443
0.0.0.0/0
Allows HTTPS access to the Dify web interface.
Inbound
80
0.0.0.0/0
Allows HTTP access. We recommend that you use this rule only in test environments.
Outbound
All
0.0.0.0/0
Allows the instance to access external services, such as model APIs and knowledge bases.
For security purposes, we recommend that you set the authorization object to a specific IP address range instead of 0.0.0.0/0, which grants access to all IP addresses.
Configure a custom domain name
You can bind a custom domain name to a Dify instance so that users can access the Dify platform by using a memorable domain name.
Log on to the AI-Native Database Service console.
On the details page of the target Dify instance, find the Domain Management section.
Click Add Domain Name.
Enter a domain name that has obtained an ICP filing, for example,
dify.example.com.Follow the on-screen instructions to add a CNAME record in your DNS settings. Point the custom domain name to the default endpoint of the instance.
After the DNS record takes effect, click Verify. After the verification succeeds, you can access the Dify instance by using the custom domain name.
The time required for DNS resolution to take effect depends on the DNS provider. It typically takes a few minutes to 48 hours.
Configure public network access
If you want to access a Dify instance over the Internet, you can enable public network access.
On the instance details page, turn on the Public Access switch in the Network Configuration section.
The system automatically assigns a public endpoint. You can view the endpoint in the Connection Information section.
We recommend that you configure an IP allowlist to restrict the range of public IP addresses that can access the instance.
After you enable public network access, make sure that you configure security group rules and an IP allowlist to prevent unauthorized access.