Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPSEXP-2354 Fix nginx redirect when behind ELB via argument #698

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions roles/nginx/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ setup_vhosts: true

# Disable when nginx node is behind another reverse proxy (e.g. AWS ELB)
nginx_set_proxy_headers: true
nginx_absolute_redirect: true
8 changes: 8 additions & 0 deletions roles/nginx/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@ argument_specs:
description: If the nginx reverse proxy vhosts should be enabled
type: bool
default: true
nginx_set_proxy_headers:
description: Useful when nginx node is behind another reverse proxy (e.g. should be disabled when behind an AWS ELB)
type: bool
default: true
nginx_absolute_redirect:
description: Useful when nginx node is behind another reverse proxy (e.g. should be disabled when behind an AWS ELB)
type: bool
default: true
2 changes: 2 additions & 0 deletions roles/nginx/templates/alfresco_proxy.include.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
client_max_body_size 0;

absolute_redirect {{ 'on' if nginx_absolute_redirect else 'off' }};

set $allowOriginSite *;
proxy_pass_request_headers on;
proxy_pass_header Set-Cookie;
Expand Down
6 changes: 3 additions & 3 deletions roles/nginx/templates/alfresco_redirect.conf.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
map $remote_addr $rogue_repo_clients {
default 1;
::1 0;
127.0.0.1 0;
default 1;
::1 0;
127.0.0.1 0;
{% for trusted_repo_client in (repo_hosts | map(attribute='local_addr') + [ solr_host, sync_host ]) | unique | reject('equalto', '127.0.0.1') %}
{{ trusted_repo_client }} 0;
{% endfor %}
Expand Down