Skip to content

Commit

Permalink
force upstream http 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ChandonPierre committed Jan 30, 2024
1 parent e6a0659 commit ebc73c9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ ENV ALLOW_PUSH="false"
# Default is true to not change default behavior.
ENV PROXY_REQUEST_BUFFERING="true"

# Force HTTP/1.1 upstream connections, for http2 upstream that returns 426 Upgrade Required
ENV FORCE_UPSTREAM_HTTP_1_1="false"

# Stream data; reduce TTFB
# Effectively disables caching
# Default is true to not change default behavior.
Expand Down
14 changes: 14 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,20 @@ echo -e "\nRequest buffering: ---"
cat /etc/nginx/proxy.request.buffering.conf
echo -e "---\n"

# force upstream to use http 1.1
echo "" > /etc/nginx/http1.1.upstream.conf
if [[ "a${FORCE_UPSTREAM_HTTP_1_1}" == "atrue" ]]; then
cat << EOD > /etc/nginx/http1.1.upstream.conf
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
EOD
fi

echo -e "\nConfigure upstream http version support: ---"
cat /etc/nginx/http1.1.upstream.conf
echo -e "---\n"

# Upstream SSL verification.
echo "" > /etc/nginx/docker.verify.ssl.conf
if [[ "a${VERIFY_SSL}" == "atrue" ]]; then
Expand Down
3 changes: 3 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
# Use SNI during the TLS handshake with the upstream.
proxy_ssl_server_name on;

# force upstream to use http 1.1
include /etc/nginx/http1.1.upstream.conf;

# This comes from a include file generated by the entrypoint.
include /etc/nginx/docker.verify.ssl.conf;

Expand Down

0 comments on commit ebc73c9

Please sign in to comment.