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

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
Help Center/ API Gateway/ Best Practices/ API Security/ Using WAF to Protect APIG

Using WAF to Protect APIG

Updated on 2025-01-24 GMT+08:00

Scenario

To protect API Gateway and your backend servers from malicious attacks, deploy Web Application Firewall (WAF) between API Gateway and the external network.

Solution Architecture

Figure 1 Access to a backend server

Advantages

Solution 1: Providing services using API group domain names is highly scalable.

(Recommended) Solution 1: Register API Group Debugging Domain Name on WAF and Use the Domain Name to Access the Backend Service

  1. Create an API group in a gateway, record the domain name, and create an API in the group.

    1. Log in to the APIG console, and choose API Management > API Groups.
    2. Click Create API Group > Create Directly and enter the group name.
    3. Click the name of the created group. The group details page is displayed.
    4. On the Group Information tab, view and record the debugging domain name. It is unique and cannot be changed. It can be accessed up to 1,000 times a day.
    5. On the APIs tab, click Create API > Create API to add an API.

  1. Add a domain name to WAF. Log in to the WAF console and choose Website Settings > Add Website. When configuring the Server Address, you need to enter the domain name of the API group and add a certificate. After adding a domain name, you need to whitelist the back-to-origin IP addresses, test WAF locally, and modify the DNS resolution settings of the domain name. For details, see Connection Process (Cloud Mode).

    Users can use a public network client to access WAF with its domain name. WAF then uses the same domain name to forward the request to APIG. There is no limit on the number of requests that APIG can receive for the domain name.

  2. On the gateway details page, bind the domain name to the API group.

    1. Go to the APIG console, and choose API Management > API Groups.
    2. Click the name of a created group.
    3. On the Group Information tab, click Bind Independent Domain Name.
    4. In the dialog box that is displayed, add the domain name.

  3. Enable real_ip_from_xff and set the parameter value to 1.

    1. In the navigation pane of the APIG console, choose Gateways.
    2. On the Parameters tab, configure real_ip_from_xff.

      When a user accesses WAF using a public network client, WAF records the actual IP address of the user in the HTTP header X-Forwarded-For. APIG resolves the actual IP address of the user based on the header.

Solution 2: Forward Requests Through the DEFAULT Group and Use Gateway Inbound Access Address to Access the Backend Service from WAF

  1. View the inbound access addresses of your gateway. There is no limit on the number of times the API gateway can be accessed using an IP address.

    1. Log in to the APIG console, and choose Gateways in the navigation pane.
    2. Click the gateway name or Access Console.
    3. On the Basic Information tab, view the inbound access.
      • VPC Access Address: VPC private access address
      • EIP: public network access address

  1. Create an API in the DEFAULT group.

    1. Go to the APIG console, and choose API Management > API Groups.
    2. Click the name of the DEFAULT group.
    3. Click Create API > Create API to add an API.

  1. Add a domain name to WAF. Log in to the WAF console and choose Website Settings > Add Website. Set the Server Address to the inbound access of the gateway and add a certificate. After adding a domain name, you need to whitelist the back-to-origin IP addresses, test WAF locally, and modify the DNS resolution settings of the domain name. For details, see Connection Process (Cloud Mode).

    • If WAF and your gateway are in the same VPC, set Server Address to the VPC access address.
    • If your gateway is bound with an EIP, set Server Address to the EIP.

  2. On the gateway details page, bind the domain name to the DEFAULT group.

    1. Go to the APIG console, and choose API Management > API Groups.
    2. Click the name of the DEFAULT group.
    3. On the Group Information tab, click Bind Independent Domain Name.
    4. In the dialog box that is displayed, add the domain name.

  3. Enable real_ip_from_xff and set the parameter value to 1.

    1. In the navigation pane of the APIG console, choose Gateways.
    2. On the Parameters tab, configure real_ip_from_xff.

      When a user accesses WAF using a public network client, WAF records the actual IP address of the user in the HTTP header X-Forwarded-For. APIG resolves the actual IP address of the user based on the header.

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