summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJohn Westcott IV <32551173+john-westcott-iv@users.noreply.github.com>2023-05-23 19:05:38 +0200
committerGitHub <noreply@github.com>2023-05-23 19:05:38 +0200
commitdaf39dc77ecb75a97f7509ffa58ab76b18f4e8a9 (patch)
treec3f3986350de9159534fed0d92e63e7a12eb4506 /tools
parentChange logging setting for task analytic scheduler (#14031) (diff)
downloadawx-daf39dc77ecb75a97f7509ffa58ab76b18f4e8a9.tar.xz
awx-daf39dc77ecb75a97f7509ffa58ab76b18f4e8a9.zip
Adding capability of pretty error pages (#13852)
Co-authored-by: Jessica Steurer <70719005+jay-steurer@users.noreply.github.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/docker-compose/ansible/roles/sources/tasks/main.yml10
-rw-r--r--tools/docker-compose/ansible/roles/sources/templates/nginx.conf.j29
2 files changed, 19 insertions, 0 deletions
diff --git a/tools/docker-compose/ansible/roles/sources/tasks/main.yml b/tools/docker-compose/ansible/roles/sources/tasks/main.yml
index 17ab4dc0c9..417807f02b 100644
--- a/tools/docker-compose/ansible/roles/sources/tasks/main.yml
+++ b/tools/docker-compose/ansible/roles/sources/tasks/main.yml
@@ -42,6 +42,16 @@
dest: "{{ sources_dest }}/SECRET_KEY"
no_log: true
+- name: Find custom error pages
+ set_fact:
+ custom_error_pages: "{{ (custom_error_pages | default([])) + [new_error_page] }}"
+ vars:
+ new_error_page:
+ error_code: "{{ item | basename() | regex_replace('custom_(\\d+).html', '\\1') }}"
+ web_path: "{{ item | regex_replace('^.*\/static', '/static') }}"
+ loop: "{{ lookup('ansible.builtin.fileglob', playbook_dir + '/../../../awx/static/custom_*.html', wantlist=True) }}"
+ when: (item | basename()) is regex("custom_\d+\.html")
+
- name: Render configuration templates
template:
src: "{{ item }}.j2"
diff --git a/tools/docker-compose/ansible/roles/sources/templates/nginx.conf.j2 b/tools/docker-compose/ansible/roles/sources/templates/nginx.conf.j2
index ff7e2ab386..7115e15582 100644
--- a/tools/docker-compose/ansible/roles/sources/templates/nginx.conf.j2
+++ b/tools/docker-compose/ansible/roles/sources/templates/nginx.conf.j2
@@ -44,6 +44,11 @@ http {
add_header Strict-Transport-Security max-age=15768000;
add_header X-Content-Type-Options nosniff;
+ # Pretty error pages
+ {% for error_page in custom_error_pages %}
+ error_page {{ error_page.error_code }} {{ error_page.web_path }};
+ {% endfor %}
+
include /etc/nginx/conf.d/*.conf;
}
@@ -70,6 +75,10 @@ http {
add_header Strict-Transport-Security max-age=15768000;
add_header X-Content-Type-Options nosniff;
+ # Pretty error pages
+ {% for error_page in custom_error_pages %}
+ error_page {{ error_page.error_code }} {{ error_page.web_path }};
+ {% endfor %}
include /etc/nginx/conf.d/*.conf;
}