mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
test: add tests for trust-x-forwarded-for, refs #4339
This commit is contained in:
@@ -156,6 +156,53 @@ teardown() {
|
||||
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" {
|
||||
deploy_app
|
||||
run /bin/bash -c "dokku nginx:validate-config"
|
||||
|
||||
Reference in New Issue
Block a user