Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP 444 (No Response) instead of 404, 403 error pages?

I always use "return 444" in the nginx config to stop crawlers that access my servers directly via IP or via the wrong hostname. It just closes the connection. Perfect.

Now i want to use this response instead of the standard 404.html pages that nginx throws but i fail at configuring.

    error_page 500 502 503 504 /custom_50x.html;

This works fine, but i cant "return 444" like here:

    server {
    listen      80;
    server_name "";
    return      444;
}

Does anybody know a way to combine these two?

Thanks in advance!

like image 736
Howard Avatar asked Jan 02 '17 03:01

Howard


1 Answers

Redirect request then you can return status code easily

server {
error_page 500 502 503 504 =444 @blackhole;

  location @blackhole {
    return 444;
  }
}
like image 135
Shahzaib Ali Khan Avatar answered Sep 16 '22 21:09

Shahzaib Ali Khan