Commit 89bff4522b281c40c8b48fd070597e771469b15b
1 parent
7ec65795
Exists in
master
and in
65 other branches
noosfero: fix hostname used in redirects
Showing
2 changed files
with
6 additions
and
1 deletions
Show diff stats
cookbooks/noosfero/templates/nginx.conf.erb
| @@ -23,7 +23,7 @@ server { | @@ -23,7 +23,7 @@ server { | ||
| 23 | proxy_read_timeout 90; | 23 | proxy_read_timeout 90; |
| 24 | proxy_connect_timeout 90; | 24 | proxy_connect_timeout 90; |
| 25 | proxy_redirect off; | 25 | proxy_redirect off; |
| 26 | - proxy_set_header Host $host; | 26 | + proxy_set_header Host <%= node['config']['external_hostname'] %>; |
| 27 | proxy_set_header X-Real-IP $remote_addr; | 27 | proxy_set_header X-Real-IP $remote_addr; |
| 28 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | 28 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 29 | } | 29 | } |
test/noosfero_test.sh
| @@ -23,5 +23,10 @@ test_reverse_proxy_static_files() { | @@ -23,5 +23,10 @@ test_reverse_proxy_static_files() { | ||
| 23 | assertEquals "Content-Type: image/png" "$content_type" | 23 | assertEquals "Content-Type: image/png" "$content_type" |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | +test_redirect_with_correct_hostname_behind_proxy() { | ||
| 27 | + local redirect="$(curl-host softwarepublico.dev --head https://softwarepublico.dev/social/search/contents | grep-header Location)" | ||
| 28 | + assertEquals "Location: https://softwarepublico.dev/social/search/articles" "$redirect" | ||
| 29 | +} | ||
| 30 | + | ||
| 26 | 31 | ||
| 27 | load_shunit2 | 32 | load_shunit2 |