Skip to content

Commit 45ad55d

Browse files
sacesrpardini
authored andcommitted
add option to disable request buffering.
If push is allowed, buffering requests can cause issues on slow upstreams. The put requests pile up, and since `proxy_ignore_client_abort` is on... ...the push fails. If you have trouble pushing, set `PROXY_REQUEST_BUFFERING`to false, then fix remainig issues/timeouts. Default is true to not change default behavior.
1 parent 149da3b commit 45ad55d

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

Diff for: Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ ENV MANIFEST_CACHE_DEFAULT_TIME="1h"
9797
# Should we allow actions different than pull, default to false.
9898
ENV ALLOW_PUSH="false"
9999

100+
# If push is allowed, buffering requests can cause issues on slow upstreams.
101+
# If you have trouble pushing, set this to false first, then fix remainig timouts.
102+
# Default is true to not change default behavior.
103+
ENV PROXY_REQUEST_BUFFERING="true"
104+
100105
# Timeouts
101106
# ngx_http_core_module
102107
ENV SEND_TIMEOUT="60s"

Diff for: README.md

+4
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ for this to work it requires inserting a root CA certificate into system trusted
8787
- `hostname`s listed here should be listed in the REGISTRIES environment as well, so they can be intercepted.
8888
- Env `AUTH_REGISTRIES_DELIMITER` to change the separator between authentication info. By default, a space: "` `". If you use keys that contain spaces (as with Google Cloud Registry), you should update this variable, e.g. setting it to `AUTH_REGISTRIES_DELIMITER=";;;"`. In that case, `AUTH_REGISTRIES` could contain something like `registry1.com:user1:pass1;;;registry2.com:user2:pass2`.
8989
- Env `AUTH_REGISTRY_DELIMITER` to change the separator between authentication info *parts*. By default, a colon: "`:`". If you use keys that contain single colons, you should update this variable, e.g. setting it to `AUTH_REGISTRIES_DELIMITER=":::"`. In that case, `AUTH_REGISTRIES` could contain something like `registry1.com:::user1:::pass1 registry2.com:::user2:::pass2`.
90+
- Env `PROXY_REQUEST_BUFFERING`: If push is allowed, buffering requests can cause issues on slow upstreams.
91+
If you have trouble pushing, set this to `false` first, then fix remainig timeouts.
92+
Default is `true` to not change default behavior.
93+
ENV PROXY_REQUEST_BUFFERING="true"
9094
- Timeouts ENVS - all of them can pe specified to control different timeouts, and if not set, the defaults will be the ones from `Dockerfile`. The directives will be added into `http` block.:
9195
- SEND_TIMEOUT : see [send_timeout](http://nginx.org/en/docs/http/ngx_http_core_module.html#send_timeout)
9296
- CLIENT_BODY_TIMEOUT : see [client_body_timeout](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_timeout)

Diff for: entrypoint.sh

+14
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,20 @@ echo -e "\nTimeout configs: ---"
254254
cat /etc/nginx/nginx.timeouts.config.conf
255255
echo -e "---\n"
256256

257+
# Request buffering
258+
echo "" > /etc/nginx/proxy.request.buffering.conf
259+
if [[ "a${PROXY_REQUEST_BUFFERING}" == "afalse" ]]; then
260+
cat << EOD > /etc/nginx/proxy.request.buffering.conf
261+
proxy_max_temp_file_size 0;
262+
proxy_request_buffering off;
263+
proxy_http_version 1.1;
264+
EOD
265+
fi
266+
267+
echo -e "\nRequest buffering: ---"
268+
cat /etc/nginx/proxy.request.buffering.conf
269+
echo -e "---\n"
270+
257271
# Upstream SSL verification.
258272
echo "" > /etc/nginx/docker.verify.ssl.conf
259273
if [[ "a${VERIFY_SSL}" == "atrue" ]]; then

Diff for: nginx.conf

+3
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
227227

228228
proxy_read_timeout 900;
229229

230+
# Request buffering
231+
include /etc/nginx/proxy.request.buffering.conf;
232+
230233
# Use cache locking, with a huge timeout, so that multiple Docker clients asking for the same blob at the same time
231234
# will wait for the first to finish instead of doing multiple upstream requests.
232235
proxy_cache_lock on;

0 commit comments

Comments
 (0)