Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

How can I catch empty AND undefined server name?

$
0
0
Hello, everyone.

I want to catch all invalid server name (empty AND undefined server name) to prevent invalid access.
But I confuse whether my configuration is exactly right.

I read two documents.

1. http://nginx.org/en/docs/http/server_names.html#miscellaneous_names
2. http://nginx.org/en/docs/http/request_processing.html#how_to_prevent_undefined_server_names

I thought that 'default_server' catches undefined server name, 'server_name _' doesn't have meaning and 'server_name ""' catches empty server name, but it can be omitted because of default setting.
So I wrote a configuration:

server {
listen 80 default_server;
return 444;
}

Is this configuration right? Thanks.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>