Skip to content

Commit a89cf36

Browse files
author
Stan Yagolnitser
committed
set nginx DNS configuration from container resolv.conf to allow proxy to operate behind firewall
1 parent 97e77cc commit a89cf36

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
set -Eeuo pipefail
44
trap "echo TRAPed signal" HUP INT QUIT TERM
55

6+
#configure nginx DNS settings to match host, why must we do that nginx?
7+
conf="resolver $(/usr/bin/awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf) ipv6=off; # Avoid ipv6 addresses for now"
8+
[ "$conf" = "resolver ;" ] && echo "no nameservers found" && exit 0
9+
confpath=/etc/nginx/resolvers.conf
10+
if [ ! -e $confpath ] || [ "$conf" != "$(cat $confpath)" ]
11+
then
12+
echo "$conf" > $confpath
13+
fi
14+
615
# The list of SAN (Subject Alternative Names) for which we will create a TLS certificate.
716
ALLDOMAINS=""
817

nginx.conf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ http {
108108
proxy_max_temp_file_size 0;
109109

110110
# We need to resolve the real names of our proxied servers.
111-
resolver 8.8.8.8 4.2.2.2 ipv6=off; # Avoid ipv6 addresses for now
111+
#resolver 8.8.8.8 4.2.2.2 ipv6=off; # Avoid ipv6 addresses for now
112+
include /etc/nginx/resolvers.conf;
112113

113114
# forward proxy for non-CONNECT request
114115
location / {
@@ -140,7 +141,8 @@ http {
140141
ssl_certificate_key /certs/web.key;
141142

142143
# We need to resolve the real names of our proxied servers.
143-
resolver 8.8.8.8 4.2.2.2 ipv6=off; # Avoid ipv6 addresses for now
144+
#resolver 8.8.8.8 4.2.2.2 ipv6=off; # Avoid ipv6 addresses for now
145+
include /etc/nginx/resolvers.conf;
144146

145147
# Docker needs this. Don't ask.
146148
chunked_transfer_encoding on;
@@ -238,4 +240,4 @@ http {
238240
}
239241

240242
}
241-
}
243+
}

0 commit comments

Comments
 (0)