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 authored and Jose Diaz-Gonzalez committed 2021-01-23 15:09:51 -05:00
1 parent 6ab9f28d77
commit 8cc92680c5
4 files changed
+67 -1

No files matched your search

+38
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"