Francis Daly
April 14, 2022 08:30AM
On Thu, Apr 14, 2022 at 07:02:28AM -0400, arx wrote:

Hi there,

> the important thing for me is the dns, the port is static and no server do
> the check,
> the problem that I don't know how it is calls the variable with what name
> the client makes the request (the dns that is invoked in the GET method by
> the client) present in access.log
>
> [14/Apr/2022:12:22:57 +0200] "GET /favicon.ico HTTP/1.1" 404 548
> "http://DNS:PORT/" "Mozilla/5.0 (........

log_format (http://nginx.org/r/log_format) describes what is written to
access.log (access_log on the same page).

The part you mention there is $http_referer; but you probably want to use
$host. See http://nginx.org/en/docs/http/request_processing.html, so that
you do not have to use $host.

> I have to check on dns, and when I go to put the condition (as in the
> previous example it gives me a syntax error)

I believe you will be much happier if you do something like

"""
server {
listen port;
server_name good-name-one good-name-two
good-name-three;

location / {
# proxy_pass or whatever is wanted. For testing:
return 200 "Ok - host $host is allowed\n";
}
}
server {
listen port default_server;
return 200 "No - host $host is not allowed\n";
}
"""

where "port" is changed to the correct number in each case.

Set the "good names" that you want to allow, and see that you get the
"no" or "ok" message for the different names that you test.

And then change the "return" lines to do what you want.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

reverse proxy with dns control

arx April 13, 2022 07:43AM

Re: reverse proxy with dns control

arx April 14, 2022 06:33AM

Re: reverse proxy with dns control

Francis Daly April 14, 2022 06:52AM

Re: reverse proxy with dns control

arx April 14, 2022 07:02AM

Re: reverse proxy with dns control

arx April 14, 2022 07:35AM

Re: reverse proxy with dns control

Francis Daly April 14, 2022 08:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 310
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready