Skip to content

Commit 1503c15

Browse files
committed
feat(entrypoint): add toggle to force http 1.1
from rpardini#128 nginx does not support http2 as a client; this alleviates registries that return 426 when using http2
1 parent f7e119e commit 1503c15

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

Diff for: Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ ENV ALLOW_PUSH="false"
110110
# Default is true to not change default behavior.
111111
ENV PROXY_REQUEST_BUFFERING="true"
112112

113+
# Force HTTP/1.1 upstream connections, for http2 upstream that returns 426 Upgrade Required
114+
ENV FORCE_UPSTREAM_HTTP_1_1="false"
115+
113116
# Stream data; reduce TTFB
114117
# Effectively disables caching
115118
# Default is true to not change default behavior.

Diff for: entrypoint.sh

+14
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,20 @@ echo -e "\nRequest buffering: ---"
358358
cat /etc/nginx/proxy.request.buffering.conf
359359
echo -e "---\n"
360360

361+
# force upstream to use http 1.1
362+
echo "" > /etc/nginx/http1.1.upstream.conf
363+
if [[ "a${FORCE_UPSTREAM_HTTP_1_1}" == "atrue" ]]; then
364+
cat << EOD > /etc/nginx/http1.1.upstream.conf
365+
proxy_http_version 1.1;
366+
proxy_set_header Upgrade \$http_upgrade;
367+
proxy_set_header Connection "upgrade";
368+
EOD
369+
fi
370+
371+
echo -e "\nConfigure upstream http version support: ---"
372+
cat /etc/nginx/http1.1.upstream.conf
373+
echo -e "---\n"
374+
361375
# Upstream SSL verification.
362376
echo "" > /etc/nginx/docker.verify.ssl.conf
363377
if [[ "a${VERIFY_SSL}" == "atrue" ]]; then

Diff for: nginx.conf

+3
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
263263
# Use SNI during the TLS handshake with the upstream.
264264
proxy_ssl_server_name on;
265265

266+
# force upstream to use http 1.1
267+
include /etc/nginx/http1.1.upstream.conf;
268+
266269
# This comes from a include file generated by the entrypoint.
267270
include /etc/nginx/docker.verify.ssl.conf;
268271

0 commit comments

Comments
 (0)