fix: Try older method
All checks were successful
Build Docker / Build Docker (push) Successful in 23s
All checks were successful
Build Docker / Build Docker (push) Successful in 23s
This commit is contained in:
parent
8ab5352a2f
commit
e04a72e89d
37
nginx.conf
37
nginx.conf
@ -6,49 +6,26 @@ upstream loadbalancer {
|
||||
server hnsns.net:443 weight=1 max_fails=1 fail_timeout=30s;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
# Catch all servers
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
# Dynamically set the Host header based on the chosen upstream
|
||||
# Get upstream 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;
|
||||
}
|
||||
|
||||
# Use the named location without the @ prefix
|
||||
proxy_pass https://dynamic_upstream;
|
||||
}
|
||||
|
||||
location dynamic_upstream {
|
||||
# Use a named location to set proxy_pass dynamically
|
||||
# Randomly select a host
|
||||
set $upstream_host loadbalancer;
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user