0

I was ddos with some IP have user agent "-" "-" Example:

34.81.3x.x - - [01/Jun/2022:09:51:33 +0700] "HEAD / HTTP/1.1" 200 0 "-" "-"
34.81.3x.y - - [01/Jun/2022:09:51:33 +0700] "HEAD / HTTP/1.1" 200 0 "-" "-"
34.81.3x.z - - [01/Jun/2022:09:51:33 +0700] "HEAD / HTTP/1.1" 200 0 "-" "-"
34.81.3x.p - - [01/Jun/2022:09:51:33 +0700] "HEAD / HTTP/1.1" 200 0 "-" "-"
...

And i use code block user-agent:

    if ($http_user_agent ~ ("-" "-")) {
        return 403;
    }

But when i restart nginx, have error: Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

How to fix it, thanks

PhiDAo
  • 3
  • 2
  • I think you're misreading your server logs, are you sure the `"-"` doesn't mean an empty-string or unspecified header, instead of a literal dash surrounded by literal double-quotes? – Dai Jun 07 '22 at 03:34
  • Does this answer your question? [Nginx Block User-Agent "-"](https://stackoverflow.com/questions/38172128/nginx-block-user-agent) – zerkms Jun 07 '22 at 03:43

0 Answers0