feat(nginx-proxy): allow disabling hsts globally and explicitly enabling it per app

https://github.com/dokku/dokku/pull/3843
This commit is contained in:
Aubrey Hewes
2021-01-06 22:06:14 +01:00
committed by Jose Diaz-Gonzalez
parent 6ab9f28d77
commit 8cc92680c5
4 changed files with 67 additions and 1 deletions

View File

@@ -107,6 +107,44 @@ teardown() {
assert_failure
}
@test "(nginx-vhosts) nginx:set --global hsts" {
setup_test_tls wildcard
local HSTS_CONF="/home/dokku/${TEST_APP}/nginx.conf.d/hsts.conf"
run deploy_app
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "Enabling HSTS"
# disable hsts globally
run /bin/bash -c "dokku nginx:set --global hsts false"
# check it is now not applied
run /bin/bash -c "dokku nginx:build-config $TEST_APP"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "Enabling HSTS" 0
# apply on app
run /bin/bash -c "dokku nginx:set $TEST_APP hsts true"
# check it is now applied
run /bin/bash -c "dokku nginx:build-config $TEST_APP"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "Enabling HSTS" 1
# disable globally
run /bin/bash -c "dokku nginx:set --global hsts"
# check it is still applied
run /bin/bash -c "dokku nginx:build-config $TEST_APP"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "Enabling HSTS" 1
}
@test "(nginx-vhosts) nginx:set bind-address" {
run deploy_app
echo "output: $output"