hns_doh_loadbalancer/nginx.conf
Nathan Woodburn abbd461f59
All checks were successful
Build Docker / Build Docker (push) Successful in 22s
fix: Remove extra location
2023-12-15 15:15:24 +11:00

46 lines
1.4 KiB
Nginx Configuration File

upstream loadbalancer {
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;
}
server {
listen 80;
server_name _;
location / {
# Randomly select a host
set $upstream_host "";
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;
}
# Set proxy_pass based on the chosen upstream
proxy_pass https://$upstream_host;
proxy_ssl_verify off;
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;
# Show which node served the request in logs
add_header X-Load-Balancer-Node $upstream_addr;
add_header X-Load-Balancer-Node-Name $upstream_host;
}
}