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

I always use "return 444" in the nginx configuration to stop scanners that access my servers directly through IP or through the wrong host name. It just closes the connection. Perfect.

Now I want to use this answer instead of the standard 404.html pages that nginx generates, but I cannot configure it.

error_page 500 502 503 504 /custom_50x.html; 

This works fine, but I cannot β€œreturn 444”, as here:

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

Does anyone know a way to combine these two?

Thanks in advance!

+5
source share
1 answer

Redirect request, then you can easily return the status code

 server { error_page 500 502 503 504 =444 @blackhole; location @blackhole { return 444; } } 
+6
source

Source: https://habr.com/ru/post/1262156/


All Articles