Struct aws_sdk_wafv2::types::GeoMatchStatement
source · #[non_exhaustive]pub struct GeoMatchStatement {
pub country_codes: Option<Vec<CountryCode>>,
pub forwarded_ip_config: Option<ForwardedIpConfig>,
}
Expand description
A rule statement that labels web requests by country and region and that matches against web requests based on country code. A geo match rule labels every request that it inspects regardless of whether it finds a match.
-
To manage requests only by country, you can use this statement by itself and specify the countries that you want to match against in the
CountryCodes
array. -
Otherwise, configure your geo match rule with Count action so that it only labels requests. Then, add one or more label match rules to run after the geo match rule and configure them to match against the geographic labels and handle the requests as needed.
WAF labels requests using the alpha-2 country and region codes from the International Organization for Standardization (ISO) 3166 standard. WAF determines the codes using either the IP address in the web request origin or, if you specify it, the address in the geo match ForwardedIPConfig
.
If you use the web request origin, the label formats are awswaf:clientip:geo:region:
and awswaf:clientip:geo:country:
.
If you use a forwarded IP address, the label formats are awswaf:forwardedip:geo:region:
and awswaf:forwardedip:geo:country:
.
For additional details, see Geographic match rule statement in the WAF Developer Guide.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.country_codes: Option<Vec<CountryCode>>
An array of two-character country codes that you want to match against, for example, [ "US", "CN" ]
, from the alpha-2 country ISO codes of the ISO 3166 international standard.
When you use a geo match statement just for the region and country labels that it adds to requests, you still have to supply a country code for the rule to evaluate. In this case, you configure the rule to only count matching requests, but it will still generate logging and count metrics for any matches. You can reduce the logging and metrics that the rule produces by specifying a country that's unlikely to be a source of traffic to your site.
forwarded_ip_config: Option<ForwardedIpConfig>
The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that's reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name.
If the specified header isn't present in the request, WAF doesn't apply the rule to the web request at all.
Implementations§
source§impl GeoMatchStatement
impl GeoMatchStatement
sourcepub fn country_codes(&self) -> &[CountryCode]
pub fn country_codes(&self) -> &[CountryCode]
An array of two-character country codes that you want to match against, for example, [ "US", "CN" ]
, from the alpha-2 country ISO codes of the ISO 3166 international standard.
When you use a geo match statement just for the region and country labels that it adds to requests, you still have to supply a country code for the rule to evaluate. In this case, you configure the rule to only count matching requests, but it will still generate logging and count metrics for any matches. You can reduce the logging and metrics that the rule produces by specifying a country that's unlikely to be a source of traffic to your site.
If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use .country_codes.is_none()
.
sourcepub fn forwarded_ip_config(&self) -> Option<&ForwardedIpConfig>
pub fn forwarded_ip_config(&self) -> Option<&ForwardedIpConfig>
The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that's reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name.
If the specified header isn't present in the request, WAF doesn't apply the rule to the web request at all.
source§impl GeoMatchStatement
impl GeoMatchStatement
sourcepub fn builder() -> GeoMatchStatementBuilder
pub fn builder() -> GeoMatchStatementBuilder
Creates a new builder-style object to manufacture GeoMatchStatement
.
Trait Implementations§
source§impl Clone for GeoMatchStatement
impl Clone for GeoMatchStatement
source§fn clone(&self) -> GeoMatchStatement
fn clone(&self) -> GeoMatchStatement
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for GeoMatchStatement
impl Debug for GeoMatchStatement
source§impl PartialEq for GeoMatchStatement
impl PartialEq for GeoMatchStatement
source§fn eq(&self, other: &GeoMatchStatement) -> bool
fn eq(&self, other: &GeoMatchStatement) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for GeoMatchStatement
Auto Trait Implementations§
impl Freeze for GeoMatchStatement
impl RefUnwindSafe for GeoMatchStatement
impl Send for GeoMatchStatement
impl Sync for GeoMatchStatement
impl Unpin for GeoMatchStatement
impl UnwindSafe for GeoMatchStatement
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more