Interface CfnWebACL.FieldToMatchProperty

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
CfnWebACL.FieldToMatchProperty.Jsii$Proxy
Enclosing class:
CfnWebACL

@Stability(Stable) public static interface CfnWebACL.FieldToMatchProperty extends software.amazon.jsii.JsiiSerializable
Specifies a web request component to be used in a rule match statement or in a logging configuration.

  • In a rule statement, this is the part of the web request that you want AWS WAF to inspect. Include the single FieldToMatch type that you want to inspect, with additional specifications as needed, according to the type. You specify a single request component in FieldToMatch for each rule statement that requires it. To inspect more than one component of the web request, create a separate rule statement for each component.

Example JSON for a QueryString field to match:

"FieldToMatch": { "QueryString": {} }

Example JSON for a Method field to match specification:

"FieldToMatch": { "Method": { "Name": "DELETE" } }

  • In a logging configuration, this is used in the RedactedFields property to specify a field to redact from the logging records. For this use case, note the following:
  • Even though all FieldToMatch settings are available, the only valid settings for field redaction are UriPath , QueryString , SingleHeader , and Method .
  • In this documentation, the descriptions of the individual fields talk about specifying the web request component to inspect, but for field redaction, you are specifying the component type to redact from the logs.
  • If you have request sampling enabled, the redacted fields configuration for logging has no impact on sampling. The only way to exclude fields from request sampling is by disabling sampling in the web ACL visibility configuration.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.wafv2.*;
 Object all;
 Object allQueryArguments;
 Object method;
 Object queryString;
 Object singleHeader;
 Object singleQueryArgument;
 Object uriPath;
 FieldToMatchProperty fieldToMatchProperty = FieldToMatchProperty.builder()
         .allQueryArguments(allQueryArguments)
         .body(BodyProperty.builder()
                 .oversizeHandling("oversizeHandling")
                 .build())
         .cookies(CookiesProperty.builder()
                 .matchPattern(CookieMatchPatternProperty.builder()
                         .all(all)
                         .excludedCookies(List.of("excludedCookies"))
                         .includedCookies(List.of("includedCookies"))
                         .build())
                 .matchScope("matchScope")
                 .oversizeHandling("oversizeHandling")
                 .build())
         .headers(HeadersProperty.builder()
                 .matchPattern(HeaderMatchPatternProperty.builder()
                         .all(all)
                         .excludedHeaders(List.of("excludedHeaders"))
                         .includedHeaders(List.of("includedHeaders"))
                         .build())
                 .matchScope("matchScope")
                 .oversizeHandling("oversizeHandling")
                 .build())
         .ja3Fingerprint(JA3FingerprintProperty.builder()
                 .fallbackBehavior("fallbackBehavior")
                 .build())
         .jsonBody(JsonBodyProperty.builder()
                 .matchPattern(JsonMatchPatternProperty.builder()
                         .all(all)
                         .includedPaths(List.of("includedPaths"))
                         .build())
                 .matchScope("matchScope")
                 // the properties below are optional
                 .invalidFallbackBehavior("invalidFallbackBehavior")
                 .oversizeHandling("oversizeHandling")
                 .build())
         .method(method)
         .queryString(queryString)
         .singleHeader(singleHeader)
         .singleQueryArgument(singleQueryArgument)
         .uriPath(uriPath)
         .build();
 

See Also: