Allow and deny custom User-Agents

Allow a client built on the Go HTTP library, and block any User-Agent header that contains scraper, in any case.

In this example:

  • The allow pattern lets Go-http-client through, even though it’s on the built-in list.
  • The deny pattern blocks any User-Agent that contains scraper. The (?i) prefix makes the match case-insensitive.

Set up the policy

Attach the policy

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!