Scenario 1: Accessing CAE Components from the Public Network
Scenario
If CAE components need to be accessed by objects outside the environment (such as external users, third-party systems, or O&M tools), the public network access capability needs to be enabled.
You can configure the port for accessing components from another environment on CAE. After the configuration, you can access the CAE components from the public network.
This section describes how to access CAE components from the public network.
Restrictions
This function is available only in CN North-Beijing4, CN South-Guangzhou, CN East-Shanghai1, ME-Riyadh, TR-Istanbul, AF-Johannesburg, LA-Mexico City2, and LA-Sao Paulo1.
Prerequisites
- You have created an environment.
 - You have created an application.
 - You have created a component. In this section, the component name is cae-test, the component instance specifications are greater than or equal to 0.5 cores, 1 GiB, the component source is a software package, and the component port is 8080.
 
Step 1: Configure an Access Domain Name
- Log in to CAE.
 - Choose System Settings.
 - Click Edit under System Networks.
 - Click the Inbound Configuration tab.
 - Click Add Domain Name Suffix and set the domain name and certificate by referring to Table 1.
 - Click Save.
 
Step 2: Configure the Port for Accessing the Component from Another Environment
- On the CAE console, choose Component Configurations in the navigation pane.
 - Select the target component cae-test from the drop-down list in the upper part of the page.
 - Click Edit in the Access Mode module.
 - In Access Component from Another Environment, set Access Domain Name by referring to Table 3. 
    
    
Table 3 Component domain name configuration Parameter
Description
Example Value
Access outside the environment
- Select the domain name *.abc.com configured in step 1.
 - Enter cae-test.
 
Access in the Environment
The domain name for accessing components in the environment cannot be changed.
Default domain name: {Component ID}.{Application ID}.internal.{Environment ID}.{Region ID}.cae.com
Example: compA.appA.internal.16dd810*******496d.cn-north-7.cae.com
Retain the default value for this parameter.
 - Click Add Forwarding Policy and configure a forwarding policy. 
    
    
Table 4 Forwarding policy configuration (HTTP) Parameter
Description
Example Value
Match URL By
You can select Prefix, Regular expression, or Exact.
- Prefix: URLs whose prefix is the same as the specified one can be accessed, for example, /healthz/v1 and /healthz/v2.
 - Regular expression: The URL rule can be set, for example, /[A-Za-z0-9_.-]+/test. All URLs that comply with this rule can be accessed, for example, /abcA9/test and /v1-Ab/test. Two regular expression standards are supported: POSIX and Perl.
 - Exact: Only the URL that is the same as the specified one can be accessed. For example, if the URL is set to /healthz, only /healthz can be accessed.
 
Prefix
URL
A URL is in the format of Protocol://IP address:Port/Path?Parameter.
After a URL is configured, the forwarding policy can accurately forward requests to the corresponding service API based on the path (for example, /a/b or /c/d).
Naming rule: Enter up to 128 characters. Start with a slash (/) and only use letters, digits, and special characters _~';@^-%#&$.*+?,=!:|/()[]{}. Example: /healthz.
If only / is entered, requests of the root path and all sub-paths under the root path are matched.
/
Component
Name of the component for which you want to configure the access mode.
cae-test
Listening Port
Receives access requests from external systems (such as ECSs in a VPC and other CAE components). The value must be the same as the port provided by the CAE component for providing services (when no port mapping is available) to ensure that requests can be accurately routed to the service entry of the target component.
Value range: 1 to 65535.
8080
 - Click OK.
 - Make the configurations take effect.
    
    
- If the component has been deployed, click Activate Settings in the upper part of the page. In the dialog box displayed on the right, confirm the configurations and click OK for the configurations to take effect.
 - If the component has not been deployed, click Set and Deploy Component in the upper part of the page. In the dialog box displayed on the right, click OK. After the deployment is complete, the configurations take effect.
 
 - After the configurations take effect, the public network address access domain name cae-test.abc.com is displayed in the access mode module.
 
(Optional) Step 3: Configure the hosts File on the Local Device to Map the Domain Name to a Specified IP Address
If the access domain name configured in step 1 is not registered and DNS resolution is not configured through a public domain name service provider (that is, the domain name cannot be used to query the corresponding IP address on the public DNS server), you need to configure the hosts file on the local device (such as a PC or ECS in a VPC) that needs to access the CAE component and add the mapping between the domain name and the public or private IP address of the CAE component so that the local device can access the CAE component using the domain name.
If the access domain name configured in step 1 has been registered and DNS resolution has been configured through a public domain name service provider, skip this step.
- Obtaining the public IP address of the load balancer selected during environment creation
    
    
- Choose Overview.
 - At the bottom of the overview page, click the name of the load balancer to go to the ELB console.
 - Click the Summary tab.
 - Find and copy the value of IPv4 EIP of the load balancer. Example Value: 198.51.100.xx
 
 - Obtaining the public IP address access domain name configured in step 2
    
    
- Choose Component Configurations.
 - On the displayed page, find and copy the public IP address access domain name cae-test.abc.com from Access Mode.
 
 - Configuring the hosts file to resolve a specific domain name to a specified IP address
    
    
- Open the hosts file on the local device.
 - Configure the hosts file based on the following rules:
      
[Destination IP address] [Domain name] #Optional annotation (describes the purpose of the mapping.)
Enter the following information in a new line:198.51.100.xx cae-test.abc.com # Local mapping: domain name for accessing the public IP address corresponding to the public IP address of the CAE component
 - Save the hosts file.
 
 
Step 4: Access the CAE Component from the Public Network
- Choose Component Configurations.
 - On the displayed page, find and copy the public IP address access domain name cae-test.abc.com from Access Mode.
 - Open the local browser and enter the copied public IP address in the address box.
    
    There are two scenarios for accessing the public network address: HTTP and HTTPS.
- HTTP scenario: http://cae-test.abc.com
 - HTTPS scenario: https://cae-test.abc.com
 
 - Press Enter to access the target CAE component.
 
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot