test: add tests for trust-x-forwarded-for, refs #4339
This commit is contained in:
1 parent
bdb160bec1
commit
7c818eda47
1 file changed
+47
@@ -156,6 +156,53 @@ teardown() {
|
|||||||
assert_output_contains "127.0.0.1:80;" 0
|
assert_output_contains "127.0.0.1:80;" 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "(nginx-vhosts) nginx:set trust-x-forwarded-for" {
|
||||||
|
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-For $remote_addr;"
|
||||||
|
|
||||||
|
run /bin/bash -c "dokku nginx:set $TEST_APP trust-x-forwarded-for true"
|
||||||
|
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-For $proxy_add_x_forwarded_for;"
|
||||||
|
|
||||||
|
run /bin/bash -c "dokku nginx:set $TEST_APP trust-x-forwarded-for false"
|
||||||
|
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-For $remote_addr;"
|
||||||
|
}
|
||||||
|
|
||||||
@test "(nginx-vhosts) nginx:validate-config" {
|
@test "(nginx-vhosts) nginx:validate-config" {
|
||||||
deploy_app
|
deploy_app
|
||||||
run /bin/bash -c "dokku nginx:validate-config"
|
run /bin/bash -c "dokku nginx:validate-config"
|
||||||
|
|||||||
Reference in new issue
Block a user