Step 5: Test Dedicated WAF Instances

To ensure that WAF can forward your website requests normally, test WAF locally after you add a website to WAF.

Prerequisites

You have performed operations in Step 1: Add a Website to WAF to Step 4: Whitelist Back-to-Source IP Addresses of Dedicated WAF Instances.

(Optional) Testing a Dedicated WAF Instance

  1. Create an ECS that is in the same VPC as the dedicated WAF instance for sending requests.
  2. Send requests to the dedicated WAF through the ECS created in Step 1.

    • Forwarding test
      curl -kv -H "Host: {protection object added to WAF}"{Client protocol in server configuration}://{IP address of the dedicated WAF instance}:{protection port}

      For example:

      curl -kv -H "Host: a.example.com" http://192.168.0.1

      If the response code is 200, the request has been forwarded.

    • Attack blocking test
      1. Ensure that the block mode for basic web protection has been enabled in the policy used for the protected website.

      2. Run the following command:
        curl -kv -H "Host: {protection object added to WAF}"{Client protocol in server configuration}://{IP address of the dedicated WAF instance}:{protection port}--data "id=1 and 1='1"
        Example:
        curl -kv -H "Host: a.example.com" http:// 192.168.X.X --data "id=1 and 1='1"

        If the response code is 418, the request has been blocked, indicating that the dedicated WAF works properly.

Testing the Dedicated WAF Instance and Dedicated ELB Load Balancer