AWS WAF URI regex don't match


Hi, I created a Web ACL with one rule to allow traffic only on some enpoint, and the default ACL action is to block requests that don't match the rule.

## Rule
Field to Match: URI Path
Regular Expression: /(account|category|post)/ 
Action: ALLOW

##  Default web ACL action for requests that don't match any rules
Action: BLOCK

The problem is that the rule match only path with two or more segments, but don't match path with 1 segment.     => MATCH - ALLOW => MATCH - ALLOW         => MATCH - ALLOW             => DON'T MATCH - BLOCK     => DON'T MATCH - BLOCK

What's wrong? I would like the rule matches also path with 1 segment. Thanks in advance

asked 2 years ago2527 views
1 Answer

Your regex ends with "/" so the last two URLs will not match because "account" in these URL does not end with "/"

Can you try with "/(account|category|post)"?


profile pictureAWS
answered 2 years ago
  • Uh really? I'm using "/" as a delimiter of the regex. Anyway now it works

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions