feat: add ability to specify X-Forwarded-Ssl header for proxied requests

Closes #4401
This commit is contained in:
Jose Diaz-Gonzalez
2021-02-20 00:02:33 -05:00
parent dbe80de925
commit f7e218637e
6 changed files with 83 additions and 3 deletions

View File

@@ -302,6 +302,68 @@ teardown() {
assert_output_contains "X-Forwarded-Proto \$http_x_forwarded_proto;"
}
@test "(nginx-vhosts) nginx:set x-forwarded-ssl" {
run deploy_app
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 "X-Forwarded-Ssl" 0
run /bin/bash -c "dokku nginx:set $TEST_APP x-forwarded-ssl on"
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 "X-Forwarded-Ssl on;"
run /bin/bash -c "dokku nginx:set $TEST_APP x-forwarded-ssl off"
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 "X-Forwarded-Ssl off;"
run /bin/bash -c "dokku nginx:set $TEST_APP x-forwarded-ssl"
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 "X-Forwarded-Ssl" 0
}
@test "(nginx-vhosts) nginx:validate-config" {
deploy_app
run /bin/bash -c "dokku nginx:validate-config"