Help Center/ Web Application Firewall/ Best Practices/ Configuring Header Field Forwarding to Disable Response Packet Compression
Updated on 2024-12-20 GMT+08:00

Configuring Header Field Forwarding to Disable Response Packet Compression

Application Scenarios

The client usually declares that response compression is supported in the Accept-Encoding header, for example, Accept-Encoding: gzip. After the response passes through WAF, WAF considers that the response meets the compression standard and compresses the response. However, after receiving the response, the client cannot automatically decompress the response packet. The website then responds abnormally.

To address this issue, you can configure Forward Field to rewrite the Accept-Encoding header for the domain name on the WAF console so that WAF does not compress the response.

Resource and Cost Planning

Table 1 Resources and costs

Resource

Description

Monthly Fee

Web Application Firewall

Cloud - professional edition:
  • Billing mode: Yearly/Monthly
  • Number of domain names that can be protected: 50
  • QPS quota: 5,000 QPS
  • Peak bandwidth: 200 Mbit/s inside the cloud and 50 Mbit/s outside the cloud

For details about pricing rules, see Billing Description.

Limitations and Constraints

Header field forwarding can be configured only in cloud CNAME access mode and dedicated mode.

Step 1: Buy the Professional Edition Cloud WAF

The following describes how to buy the standard edition cloud WAF.

  1. Log in to Huawei Cloud management console.
  2. On the management console page, choose Security & Compliance > Web Application Firewall.
  3. In the upper right corner of the page, click Buy WAF. On the purchase page displayed, select Cloud Mode for WAF Mode.

    • Region: Select the region nearest to your services WAF will protect.
    • Edition: Select Profesional.
    • Expansion Package and Required Duration: Set them based on site requirements.

  4. Confirm the product details and click Buy Now in the lower right corner of the page.
  5. Check the order details and read the WAF Disclaimer. Then, select the box and click Pay Now.
  6. On the payment page, select a payment method and pay for your order.

Step 2: Add Website Information to WAF

The following example shows how to add a website information to WAF in cloud CNAME access mode.

  1. In the navigation pane on the left, choose Website Settings.
  2. In the upper left corner of the website list, click Add Website.
  3. Select Cloud - CNAME and click Configure Now.
  4. Configure website information as prompted.

    Figure 1 Configuring basic information
    Table 2 Key parameters

    Parameter

    Description

    Example Value

    Domain Name

    Domain name you want to add to WAF for protection.

    • The domain name has an ICP license.
    • You can enter a single domain name (for example, top-level domain name example.com or level-2 domain name www.example.com) or a wildcard domain name (*.example.com).

    www.example.com

    Protected Port

    The port over which the website traffic goes

    Standard ports

    Server Configuration

    Web server address settings. You need to configure the client protocol, server protocol, server weights, server address, and server port.

    • Client Protocol: protocol used by a client to access a server. The options are HTTP and HTTPS.
    • Server Protocol: protocol used by WAF to forward client requests. The options are HTTP and HTTPS.
    • Server Address: public IP address (generally corresponding to the A record of the domain name configured on the DNS) or domain name (generally corresponding to the CNAME record of the domain name configured on the DNS) of the web server that a client accesses.
    • Server Port: service port over which the WAF instance forwards client requests to the origin server.
    • Weight: Requests are distributed across backend origin servers based on the load balancing algorithm you select and the weight you assign to each server.

    Client Protocol: Select HTTP.

    Server Protocol: HTTP

    Server Address: IPv4 XXX.XXX.1.1

    Server Port: 80

    Use Layer-7 Proxy

    You need to configure whether you deploy layer-7 proxies in front of WAF.

    Set this parameter based on your website deployment.

    Yes

  5. Click Next. Then, whitelist WAF back-to-source IP address, test WAF, and modify DNS records as prompted.

    Figure 2 Domain name added to WAF

Step 3: Configure Header Field Forwarding

  1. In the navigation pane on the left, choose Website Settings.
  2. In the Domain Name column, click the website domain name to go to the basic information page.
  3. In the Forward Field column, click . In the displayed Forward Field dialog box, enter a key/value pair, and click Add.

    Set Key to Accept-Encoding and Value to identity.

    Figure 3 Forward Field

  4. Click Confirm.