fix: keep public demo online during optional upstream DNS outages
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
# Copy nginx config template
|
||||
cp /etc/nginx/nginx.conf.template /etc/nginx/nginx.conf
|
||||
|
||||
# Use the container's own DNS (Docker and Podman use different addresses).
|
||||
# Resolve the optional external demo only on request, so its DNS outage cannot
|
||||
# prevent the dashboard from starting. Only IP literals enter nginx syntax.
|
||||
resolvers=$(awk '$1 == "nameserver" && $2 ~ /^[0-9a-fA-F:.]+$/ {
|
||||
if (index($2, ":")) printf "[%s] ", $2; else printf "%s ", $2
|
||||
}' /etc/resolv.conf)
|
||||
[ -n "$resolvers" ] || resolvers="1.1.1.1 8.8.8.8"
|
||||
sed -i "s/__ARCHY_DNS_RESOLVERS__/$resolvers/g" /etc/nginx/nginx.conf
|
||||
|
||||
# Ensure client_max_body_size 0 is present (unlimited uploads)
|
||||
# This is a safety net in case the config template was cached without the directive
|
||||
if ! grep -q 'client_max_body_size' /etc/nginx/nginx.conf; then
|
||||
|
||||
@@ -195,6 +195,8 @@ http {
|
||||
server {
|
||||
listen 2101;
|
||||
server_name _;
|
||||
resolver __ARCHY_DNS_RESOLVERS__ valid=30s ipv6=off;
|
||||
resolver_timeout 3s;
|
||||
|
||||
# Demo sign-in seeder, served same-origin to the proxied SPA.
|
||||
location = /__demo/indee-demo-signin.js {
|
||||
@@ -203,7 +205,8 @@ http {
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass https://indee.tx1138.com;
|
||||
set $indee_host indee.tx1138.com;
|
||||
proxy_pass https://$indee_host$request_uri;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_ssl_name indee.tx1138.com;
|
||||
proxy_set_header Host indee.tx1138.com;
|
||||
|
||||
Reference in New Issue
Block a user