reverse proxy with dns control

Francis Daly francis at
Thu Apr 14 10:46:58 UTC 2022

On Wed, Apr 13, 2022 at 07:43:48AM -0400, arx wrote:

Hi there,

> for security problems on my server, I should create a reverse proxy that
> allows only those who use the dns provided by me to be able to pass.
> practically I make a list with the incoming dns and I pass only those to my
> main server behind the reverse.
> is it possible to do this?

I think you might be looking for two server{} blocks; one with "listen
port default_server" that will not talk to the backend; and one with
"listen port" without "default_server", and with "server_name" with the
names that you want, that will talk to the back-end service.

See, for example, where
using the config either side of "In catch-all server examples", requests
for four names to port 80 will be handled in one server{} block, and
requests for any other names to port 80 will be handled in the other
server{} block.


Francis Daly        francis at

More information about the nginx mailing list