Skip to content

Commit

Permalink
Resolver logic improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderM91 committed Oct 1, 2024
1 parent 4d48200 commit 463ca67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions generator/src/templates/nginx/entrypoint.sh.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +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_bind $remote_addr transparent;
set $proxy_pass_endpoint {{ proxy_pass }};
proxy_pass $proxy_pass_endpoint;
}

{% endfor %}
{% endblock proxy %}

0 comments on commit 463ca67

Please sign in to comment.