Commit 89bff4522b281c40c8b48fd070597e771469b15b

Authored by Antonio Terceiro
1 parent 7ec65795

noosfero: fix hostname used in redirects

cookbooks/noosfero/templates/nginx.conf.erb
... ... @@ -23,7 +23,7 @@ server {
23 23 proxy_read_timeout 90;
24 24 proxy_connect_timeout 90;
25 25 proxy_redirect off;
26   - proxy_set_header Host $host;
  26 + proxy_set_header Host <%= node['config']['external_hostname'] %>;
27 27 proxy_set_header X-Real-IP $remote_addr;
28 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 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 32 load_shunit2
... ...