mirror of
https://github.com/ansible/awx.git
synced 2026-02-01 09:38:10 -03:30
Adding capability of pretty error pages (#13852)
Co-authored-by: Jessica Steurer <70719005+jay-steurer@users.noreply.github.com>
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user