From 9cbe77112341e848fe128624edc6b90a46fdabb7 Mon Sep 17 00:00:00 2001 From: Yihao Date: Thu, 30 Jul 2020 18:36:10 +0930 Subject: [PATCH] Fix proxy-read-timeout is not set for HTTPS --- .../nginx-vhosts/templates/nginx.conf.sigil | 1 + tests/unit/nginx-vhosts_8.bats | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/plugins/nginx-vhosts/templates/nginx.conf.sigil b/plugins/nginx-vhosts/templates/nginx.conf.sigil index a85f942e3..2e9ed3308 100644 --- a/plugins/nginx-vhosts/templates/nginx.conf.sigil +++ b/plugins/nginx-vhosts/templates/nginx.conf.sigil @@ -84,6 +84,7 @@ server { proxy_pass http://{{ $.APP }}-{{ $upstream_port }}; {{ if eq $.HTTP2_PUSH_SUPPORTED "true" }}http2_push_preload on; {{ end }} proxy_http_version 1.1; + proxy_read_timeout {{ $.PROXY_READ_TIMEOUT }}; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_set_header Host $http_host; diff --git a/tests/unit/nginx-vhosts_8.bats b/tests/unit/nginx-vhosts_8.bats index 857ea2182..77ab46c46 100644 --- a/tests/unit/nginx-vhosts_8.bats +++ b/tests/unit/nginx-vhosts_8.bats @@ -138,6 +138,41 @@ teardown() { assert_output_contains "45s;" 0 } +@test "(nginx-vhosts) nginx:set proxy-read-timeout (with SSL)" { + setup_test_tls + deploy_app + + run /bin/bash -c "dokku nginx:set $TEST_APP proxy-read-timeout 45s" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku nginx:build-config $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku nginx:show-config $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_output_contains "45s;" + + run /bin/bash -c "dokku nginx:set $TEST_APP proxy-read-timeout" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku nginx:build-config $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku nginx:show-config $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_output_contains "45s;" 0 +} + @test "(nginx-vhosts) nginx:build-config (with SSL and unrelated domain)" { setup_test_tls add_domain "node-js-app.dokku.me"