Can I write like this...? if ($http_user_agent ~ (AAA|BBB|^$)) {return 400;} Posted at Nginx Forum: http://forum.nginx.org/read.php?2,87266,87285#msg-87285