diff --git a/generator/src/templates/nginx/entrypoint.sh.twig b/generator/src/templates/nginx/entrypoint.sh.twig index 4f12ec3c8..015c12993 100644 --- a/generator/src/templates/nginx/entrypoint.sh.twig +++ b/generator/src/templates/nginx/entrypoint.sh.twig @@ -9,12 +9,13 @@ export SPRYKER_NGINX_CGI_{{ applicationName | upper}}=${SPRYKER_NGINX_CGI_{{ (ap {% endfor %} {% endfor %} -envsubst '{{ envVariables | join(' ') }}' < /etc/nginx/template/default.conf.tmpl > /etc/nginx/conf.d/default.conf - if [ -z "${SPRYKER_DNS_RESOLVER_IP}" ]; then export SPRYKER_DNS_RESOLVER_IP=$(grep "nameserver" /etc/resolv.conf | awk '{print $2}') + {% set envVariables = envVariables | merge(["\$SPRYKER_DNS_RESOLVER_IP"]) %} fi +envsubst '{{ envVariables | join(' ') }}' < /etc/nginx/template/default.conf.tmpl > /etc/nginx/conf.d/default.conf + envsubst '$SPRYKER_DNS_RESOLVER_IP ${SPRYKER_DNS_RESOLVER_FLAGS} {{ envVariables | join(' ') }}' < /etc/nginx/template/resolver.conf.tmpl > /etc/nginx/conf.d/00-resolver.conf if [ -n "${SPRYKER_XDEBUG_MODE_ENABLE}" ]; then diff --git a/generator/src/templates/nginx/http/proxy/reverse-proxy.conf.twig b/generator/src/templates/nginx/http/proxy/reverse-proxy.conf.twig index af7e6fbd5..6ec928c59 100644 --- a/generator/src/templates/nginx/http/proxy/reverse-proxy.conf.twig +++ b/generator/src/templates/nginx/http/proxy/reverse-proxy.conf.twig @@ -1,13 +1,14 @@ {% block proxy %} {% for location, proxy_pass in endpointData['proxy'] %} location {{ location }} { + resolver ${SPRYKER_DNS_RESOLVER_IP} valid=1s; 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; proxy_set_header Host $http_host; - proxy_pass {{ proxy_pass }}; + set $proxy_pass_endpoint {{ proxy_pass }}; + proxy_pass $proxy_pass_endpoint; } - {% endfor %} {% endblock proxy %}