هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Adding a Forwarding Policy

Updated on 2023-12-18 GMT+08:00

API Format

Method

URI

Description

POST

/v2.0/lbaas/l7policies

Adds a forwarding policy.

Application Scenarios

By adding forwarding policies and rules, you can forward different requests to a specific backend server.

Suppose that you have several servers on the cloud platform to provide services for the Internet, and the resources mainly include music (/music/{music_id}), images (/pic/{pic_id}), and files (/file/{file_id}). If there are no forwarding policies, each backend server has a copy of all resources. Requests from a client are always distributed to only one backend server. Therefore, only one copy is used. The storage cost increases as there are more and more backend servers.

Forwarding policies and rules provided by ELB can well solve this problem. In this way, the storage cost is reduced and you can obtain better economic benefits.

Constraints

  • Forwarding policies can be added for listeners when protocol is set to HTTP or TERMINATED_HTTPS.
  • The value of redirect_pool configured for the forwarding policy cannot be the same as that of default_pool configured for the listener.
  • The backend server group specified in redirect_pool cannot be used by forwarding policies of other listeners.

Scenario Assumption

Assume that you have created a load balancer named loadbalancer_1. You can add a listener named listener_1 and three backend server groups pool_1, pool_2, and pool_3. pool_1 is the default backend server group of listener_1, and pool_2 and pool_3 are associated with loadbalancer_1. For better load distribution, HTTP requests whose URI starts with /music are sent to pool_2, and HTTP requests whose URI starts with /pic are forwarded to pool_3.

Procedure

To match the URIs, HTTP messages need to be parsed. Therefore, the listener and three backend server groups must use the HTTP or HTTPS protocol.

  1. Add an HTTP listener named listener_1.

    POST https://elb.cn-east-2.myhuaweicloud.com/v2.0/lbaas/listeners
    {
        "listener": {
            "protocol_port": "80",
            "protocol": "HTTP",
            "loadbalancer_id": "abe3ee34-1882-408f-a2ba-1ce7e428d6e3",
            "name": "listener_1",
            "admin_state_up": true
        }
    }

  2. Add a backend server group named pool_1 and its backend protocol is HTTP.

    POST https://elb.cn-east-2.myhuaweicloud.com/v2.0/lbaas/pools/
    { 
      "pool": { 
      "name":"pool_1",
        "lb_algorithm": "ROUND_ROBIN", 
        "listener_id": "a7b996cf-23ec-4c0b-b310-45495d29f80c", 
        "protocol": "HTTP", 
        "admin_state_up": true 
      } 
    }

  3. Add a backend server group named pool_2 and its backend protocol is HTTP.

    POST https://elb.cn-east-2.myhuaweicloud.com/v2.0/lbaas/pools/
    { 
      "pool": { 
      "name":"pool_2",
        "lb_algorithm": "ROUND_ROBIN", 
        "listener_id": "a7b996cf-23ec-4c0b-b310-45495d29f80c", 
        "protocol": "HTTP", 
        "admin_state_up": true 
      } 
    }

  4. Add a backend server group named pool_3 and its backend protocol is HTTP.

    POST https://elb.cn-east-2.myhuaweicloud.com/v2.0/lbaas/pools/
    { 
      "pool": { 
      "name":"pool_3",
        "lb_algorithm": "ROUND_ROBIN", 
        "listener_id": "a7b996cf-23ec-4c0b-b310-45495d29f80c", 
        "protocol": "HTTP", 
        "admin_state_up": true 
      } 
    }

  5. Add a forwarding policy to pool_2.

    POST https://elb.cn-east-2.myhuaweicloud.com/v2.0/lbaas/l7policies
    { 
        "l7policy": { 
            "action": "REDIRECT_TO_POOL",  
            "listener_id": "a7b996cf-23ec-4c0b-b310-45495d29f80c",  
            "redirect_pool_id": "b9a01911-8364-44d8-ab5a-4f635820edb2",  
            "name": "l7policy_music",  
            "admin_state_up": true 
        } 
    }

  6. Add a forwarding policy to pool_3.

    POST https://elb.cn-east-2.myhuaweicloud.com/v2.0/lbaas/l7policies
    { 
        "l7policy": { 
            "action": "REDIRECT_TO_POOL",  
            "listener_id": "a7b996cf-23ec-4c0b-b310-45495d29f80c",  
            "redirect_pool_id": "3a9b8338-3086-4acc-92e6-83c5e750e44a",  
            "name": "l7policy_pic",  
            "admin_state_up": true 
        } 
    }

  7. Check the created forwarding policies. They do not match any request because there are no specific forwarding rules. To make the forwarding policies to take effect, forwarding rules must be added to forward requests with different URIs.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback