hns_doh_loadbalancer/nginx.conf

38 lines
1.1 KiB
Nginx Configuration File
Raw Normal View History

2023-12-15 14:29:49 +11:00
upstream loadbalancer {
2023-12-15 14:53:49 +11:00
server doh.hnshosting.au:443 weight=1 max_fails=1 fail_timeout=30s;
server easyhandshake.com:8053 weight=1 max_fails=1 fail_timeout=30s;
server doh.hnsdns.com:443 weight=1 max_fails=1 fail_timeout=30s;
server hs.dnssec.dev:443 weight=1 max_fails=1 fail_timeout=30s;
server hnsns.net:443 weight=1 max_fails=1 fail_timeout=30s;
2023-12-15 14:29:49 +11:00
}
2023-12-15 14:53:49 +11:00
map $host $upstream {
~^doh\.hnshosting\.au$ doh.hnshosting.au;
~^easyhandshake\.com$ easyhandshake.com;
~^doh\.hnsdns\.com$ doh.hnsdns.com;
~^hs\.dnssec\.dev$ hs.dnssec.dev;
~^hnsns\.net$ hnsns.net;
}
2023-12-15 14:29:49 +11:00
server {
listen 80;
2023-12-15 14:34:37 +11:00
# Catch all servers
server_name _;
2023-12-15 14:29:49 +11:00
location / {
2023-12-15 14:53:49 +11:00
# Set the upstream based on the host header
proxy_set_header Host $upstream;
2023-12-15 14:34:37 +11:00
proxy_pass https://loadbalancer;
2023-12-15 14:53:49 +11:00
proxy_ssl_verify off;
2023-12-15 14:29:49 +11:00
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
2023-12-15 14:34:37 +11:00
# Show which node served the request in logs
add_header X-Load-Balancer-Node $upstream_addr;
2023-12-15 14:53:49 +11:00
2023-12-15 14:29:49 +11:00
}
}