Skip to content

feat(entrypoint): add toggle to force http 1.1 #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,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 @@ -358,6 +358,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 @@ -263,6 +263,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