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

DSO: reflect ndh proxy changes #936

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions ansible/roles/ndh-app/tasks/configure_proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
enabled: yes
state: stopped

- name: Get the IP address of the local resolver
ansible.builtin.command: grep '^nameserver' /etc/resolv.conf | awk '{print $2}'
register: local_resolver

- name: Set a fact to contain the IP address of the local resolver
ansible.builtin.set_fact:
ndh_dns_resolver: "{{ local_resolver.stdout }}"

- name: Add nginx proxy config
ansible.builtin.template:
src: etc/nginx/nginx.conf.j2
Expand Down
4 changes: 3 additions & 1 deletion ansible/roles/ndh-app/templates/etc/nginx/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ events {

http {
include /etc/nginx/mime.types;
resolver ${{ ndh_dns_resolver }};
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
Expand Down Expand Up @@ -39,7 +40,8 @@ http {
location / {
proxy_set_header Host $host;
proxy_redirect https://{{ ndh_proxy_host }}:443/ https://{{ ndh_proxy_host }}/;
proxy_pass https://{{ ndelius_proxy_pass }}/;
set $ndelius "https://{{ ndelius_proxy_pass }}:443$request_uri";
proxy_pass $ndelius;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
{% endif %}
Expand Down
Loading