Fix access to pages without leading slash

This commit is contained in:
nemunaire 2023-09-26 16:10:48 +02:00
parent 9e7ac3c166
commit 0516e1bcf8

View File

@ -33,10 +33,12 @@
expires max;
}
error_page 404 = @rewrite_proxy;
{% for error_page in error_pages %}
{% if error_page != 404 %}
error_page {{ error_page }} {{ error_pages[error_page] }};
{% endif %}
{% endfor %}
#try_files $uri $uri/index.html $uri.html =404;
{% for r in rewrite %}
rewrite {{ r }};
@ -45,6 +47,26 @@
location ~ /$ {
rewrite ^(.*)/ $1/index.html;
}
location @rewrite_proxy {
rewrite ^/(.*)$ /alpo-website/master/$1/index.html break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_connect_timeout 300;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Authorization "";
proxy_intercept_errors on;
chunked_transfer_encoding off;
proxy_pass https://storage_nemunaire;
{% for error_page in error_pages %}
error_page {{ error_page }} {{ error_pages[error_page] }};
{% endfor %}
}
when: server is not defined
- ansible.builtin.include_role: