# Conflicts: # web/nginx.conf.template
This commit is contained in:
commit
8266cca1ad
4 files changed
+26
-5
No files matched your search
@@ -48,6 +48,11 @@ COPY --from=build /app/frontend/dist /usr/share/nginx/html
|
||||
ENV NGINX_PORT=80
|
||||
ENV BACKEND=api
|
||||
ENV PORT=3000
|
||||
# The DNS nginx asks about BACKEND on every /api request. Docker's embedded resolver by
|
||||
# default, which is correct for compose. Nothing listens on it elsewhere, and an unreachable
|
||||
# resolver makes every /api request hang rather than fail, so any other runtime has to say
|
||||
# what its DNS is: on Kubernetes, the kube-dns/CoreDNS service address (commonly 10.96.0.10).
|
||||
ENV RESOLVER=127.0.0.11
|
||||
# Empty = the CF-Connecting-IP header is dropped before it reaches the API, so it cannot be
|
||||
# forged by a direct client. Set to $http_cf_connecting_ip only when Cloudflare is really in
|
||||
# front. Defined here too, not just in compose, so the template always renders for anyone
|
||||
|
||||
+11
-5
@@ -24,11 +24,17 @@ server {
|
||||
# travels in one PUT /api/data, and nginx's 1 MiB default would answer 413 here before the
|
||||
# API ever saw it — a sync that silently stops once the history grows past 1 MiB.
|
||||
client_max_body_size 5m;
|
||||
# Resolved per request through Docker's DNS, not once at start-up: nginx otherwise pins
|
||||
# the api container's IP when it boots, and a recreated api (new IP) means 502 on every
|
||||
# /api call until web is restarted too (issue #16). The variable is what makes nginx
|
||||
# re-resolve; lowercase so the entrypoint's envsubst leaves it alone.
|
||||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||||
# Resolved per request through the container runtime's DNS, not once at start-up: nginx
|
||||
# otherwise pins the api container's IP when it boots, and a recreated api (new IP) means
|
||||
# 502 on every /api call until web is restarted too (issue #16). The variable is what makes
|
||||
# nginx re-resolve; lowercase so the entrypoint's envsubst leaves it alone.
|
||||
#
|
||||
# RESOLVER defaults to Docker's embedded DNS, which is where this image usually runs.
|
||||
# Nothing answers on that address outside Docker, and an unreachable resolver does not
|
||||
# fail fast — every /api request hangs until it times out. Anywhere else, set RESOLVER to
|
||||
# the DNS the platform actually provides: on Kubernetes that is the kube-dns/CoreDNS
|
||||
# service address (`kubectl -n kube-system get svc kube-dns`, commonly 10.96.0.10).
|
||||
resolver ${RESOLVER} valid=10s ipv6=off;
|
||||
set $api_upstream http://${BACKEND}:${PORT};
|
||||
proxy_pass $api_upstream;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
Reference in new issue
Block a user