title: How to use AWS WAF to block requests whose "user-agent" header is not "Java/1.8"?
body: <p>I want to use AWS WAF to block the requests whose <code>user-agent</code> header is not <code>Java/1.8</code>.</p>
  <p>How can I achieve this goal?</p>
  <p>The Regex pattern of WAF doesn't support <code>Arbitrary zero-width assertions</code>.</p>
  <p>So I can't use <a href="http://www.regular-expressions.info/lookaround.html" rel="nofollow noreferrer">lookahead and lookbehind regular expression</a> in WAF.</p>
  <p>I originally want to use <code>^((?!Java\/1.8).)*$</code> to block the requests whose <code>user-agent</code> header is not <code>Java/1.8</code>.</p>
  <p>The match type of a statement in a rule builder doesn't provide <code>Not equal to string</code>.</p>
  <p><a href="https://i.stack.imgur.com/09Mlu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/09Mlu.png" alt="enter image description here" /></a></p>
  <p>So I really cannot figure out a way to achieve the goal I want.</p>