I have a setup where one webserver (bar.com) is serving lots of subdomains, so it would be convenient to use a wildcard DNS entry. At the same time I'd like to use bar.com as search domain, so that foo resolves to foo.bar.com.
The problem now is that if I set it up like this, foo.com resolves to the webservers IP if there is no foo.com elsewhere (i.e. it first tries foo.com, fails, and then tries foo.com.bar.com, which gets matched by the wildcard).
This is very inconvenient because any hostname typos ends up at the webserver instead of producing an error. Is there a way to resolve this without specifying all the subdomains explicitly? I'm thinking something like a rule saying only "bare" hostnames (i.e. names without a dot in it) should go to the webserver. (I'm using BIND as DNS server, but the answer is probably general).