diff --git a/cookbooks/noosfero/templates/nginx.conf.erb b/cookbooks/noosfero/templates/nginx.conf.erb index 34d4f6a..88c19ef 100644 --- a/cookbooks/noosfero/templates/nginx.conf.erb +++ b/cookbooks/noosfero/templates/nginx.conf.erb @@ -23,7 +23,7 @@ server { proxy_read_timeout 90; proxy_connect_timeout 90; proxy_redirect off; - proxy_set_header Host $host; + proxy_set_header Host <%= node['config']['external_hostname'] %>; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } diff --git a/test/noosfero_test.sh b/test/noosfero_test.sh index 051f3ed..83ec272 100644 --- a/test/noosfero_test.sh +++ b/test/noosfero_test.sh @@ -23,5 +23,10 @@ test_reverse_proxy_static_files() { assertEquals "Content-Type: image/png" "$content_type" } +test_redirect_with_correct_hostname_behind_proxy() { + local redirect="$(curl-host softwarepublico.dev --head https://softwarepublico.dev/social/search/contents | grep-header Location)" + assertEquals "Location: https://softwarepublico.dev/social/search/articles" "$redirect" +} + load_shunit2 -- libgit2 0.21.2