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
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80;
|
2023-12-15 14:34:37 +11:00
|
|
|
server_name _;
|
2023-12-15 14:29:49 +11:00
|
|
|
|
|
|
|
location / {
|
2023-12-15 15:14:07 +11:00
|
|
|
# Randomly select a host
|
2023-12-15 15:03:56 +11:00
|
|
|
set $upstream_host "";
|
|
|
|
|
2023-12-15 15:14:07 +11:00
|
|
|
if ($host ~* ^doh\.hnshosting\.au$) {
|
|
|
|
set $upstream_host doh.hnshosting.au;
|
|
|
|
}
|
|
|
|
if ($host ~* ^easyhandshake\.com$) {
|
|
|
|
set $upstream_host easyhandshake.com;
|
|
|
|
}
|
|
|
|
if ($host ~* ^doh\.hnsdns\.com$) {
|
|
|
|
set $upstream_host doh.hnsdns.com;
|
|
|
|
}
|
|
|
|
if ($host ~* ^hs\.dnssec\.dev$) {
|
|
|
|
set $upstream_host hs.dnssec.dev;
|
|
|
|
}
|
|
|
|
if ($host ~* ^hnsns\.net$) {
|
|
|
|
set $upstream_host hnsns.net;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Use the named location without the @ prefix
|
|
|
|
proxy_pass https://dynamic_upstream;
|
|
|
|
}
|
|
|
|
|
|
|
|
location dynamic_upstream {
|
|
|
|
# Use a named location to set proxy_pass dynamically
|
2023-12-15 15:03:56 +11:00
|
|
|
proxy_pass https://$upstream_host;
|
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
|
|
|
add_header X-Load-Balancer-Node $upstream_addr;
|
2023-12-15 15:10:31 +11:00
|
|
|
add_header X-Load-Balancer-Node-Name $upstream_host;
|
2023-12-15 14:29:49 +11:00
|
|
|
}
|
|
|
|
}
|