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

Re: Enable wildcard domains while disabling subdomains

$
0
0
Hi. Would something like this work for you?

server {
listen 80 default;
server_name _;
return 200 'default\n';
...
}

server {
listen 80;
server_name ~^.*\..*\..*$;
return 444;
}

Testing with curl...

[root@nginx-splunk conf.d]# curl -H "Host:example123.com" localhost
default

[root@nginx-splunk conf.d]# curl -H "Host:example456.com" localhost
default

[root@nginx-splunk conf.d]# curl -H "Host:subdomain.example456.com" localhost
curl: (52) Empty reply from server

[root@nginx-splunk conf.d]# curl -H "Host:subdomain.example123.com" localhost
curl: (52) Empty reply from server

--Kevin
@webopsx

Viewing all articles
Browse latest Browse all 4759

Trending Articles



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