绑定通配符条目捕获所有未定义的(NXDOMAIN)域,而不仅仅是来自本地区域,但仅适用于 curl、wget、chrome 等

绑定通配符条目捕获所有未定义的(NXDOMAIN)域,而不仅仅是来自本地区域,但仅适用于 curl、wget、chrome 等

我的设置将本地网络上未定义的主机重定向到自定义 404 页面;因此invalidhostname.subdomain.example.com对于bind9服务器将重定向到nginxProxy.subdomain.example.com。(该页面本身会重定向到另一台服务器上的 404 页面)

对于本地未定义的主机名,它按预期工作

但说到askljdaksjdad.comnslookuphost全部dig正确返回恩斯域google-chrome,但curlwget都从我的子域传递自定义 404 页面。这种情况发生在网络上的多台 Linux 机器上。

配置文件的相关部分是:
在绑定服务器上:/etc/bind/zones/forward.subdomain.example.com

subdomain.example.com       IN SOA  bind01.subdomain.example.com. nitin.subdomain.example.com (
                64         ; serial
                604800     ; refresh (1 week)
                86400      ; retry (1 day)
                2419200    ; expire (4 weeks)
                604800     ; minimum (1 week)
                )
            NS  ns02.subdomain.example.com.
            NS  bind01.subdomain.example.com.
$ORIGIN subdomain.example.com.
;*                  CNAME   nginxProxy
*.subdomain.example.com.    CNAME   nginxProxy
nginxProxy          A   192.168.1.200

在 nginxProxy 上:/etc/nginx/conf.d/default.conf

server {
# Server:port pair that this instance of nginx is running on and should listen to for incoming connections(IP address or name)
# Add "default_server" before the end of the line if this is the default server/role
    listen       nginxProxy.subdomain.example.com:80;

# Set name of the virtual server
    server_name subdomain.example.com *.subdomain.example.com www.subdomain.example.*;

# Address of target/upstream VM/server that hosts the actual service.
    set $target http://web.subdomain.example.com:8080/404/error.html;

# Location configuration
    location / {
# resolver directive needed here if using variables with server names for proxy_pass directive; as nginx doesn't like calling the unix resolver after configuration.
    resolver 192.168.1.210;
    proxy_pass $target;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_buffering off;
    client_max_body_size 0;
    proxy_read_timeout 36000s;
    proxy_redirect off;
    }
}

那么我在这里遗漏了什么?这不是预期的行为,对吗?

相关内容