mirror of
https://github.com/YunoHost-Apps/reverseproxy_ynh.git
synced 2024-09-03 20:16:23 +02:00
Start rewriting with jinja templates
This commit is contained in:
parent
3e1850d789
commit
da32e51fd9
4 changed files with 38 additions and 15 deletions
|
@ -1,5 +1,5 @@
|
|||
location @__NAME__--proxy {
|
||||
proxy_pass __PROXY_PATH__;
|
||||
location @{{ name }}--proxy {
|
||||
proxy_pass {{ proxy_path }};
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
@ -15,13 +15,26 @@ location @__NAME__--proxy {
|
|||
more_clear_input_headers 'Accept-Encoding';
|
||||
}
|
||||
|
||||
# Support relative URLs
|
||||
__REDIRECT_BLOCK__
|
||||
|
||||
location __PATH_SLASH__ {
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
|
||||
__ASSETS_ALIAS__
|
||||
__TRY_FILES__
|
||||
location = {{ path }} {
|
||||
return 302 {{ path }};
|
||||
}
|
||||
|
||||
location {{ path }}/ {
|
||||
{% if assets_path %}
|
||||
alias {{ assets_path }};
|
||||
{% endif %}
|
||||
|
||||
# This is a reverse-proxy, not a basic HTML site
|
||||
# We do not wish to enable autoindex in general, and will
|
||||
# not try_files uri/ for this reason.
|
||||
#
|
||||
# But if no assets_path is defined, try the backend directly.
|
||||
#
|
||||
# Note: We could include an app setting for autoindex some time.
|
||||
# But try_files uri/ without autoindex will result in 403.
|
||||
{% if assets_path %}
|
||||
try_files $uri @{{ name }}--proxy =@404;
|
||||
{% else %}
|
||||
try_files ${{ name }}--proxy =@404;
|
||||
{% endif %}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ license = "AGPL-3.0-or-later"
|
|||
website = "https://en.wikipedia.org/wiki/Reverse_proxy"
|
||||
|
||||
[integration]
|
||||
helpers_version = "2.1"
|
||||
yunohost = ">= 11.2"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
|
|
|
@ -25,7 +25,7 @@ rp_handle_webroot
|
|||
# Configure nginx
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add --jinja --template = "nginx.conf" --destination="/etc/nginx.conf.d/${domain}.d/${app}.conf"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
13
tests.toml
13
tests.toml
|
@ -1,7 +1,16 @@
|
|||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
|
||||
args.path = "/"
|
||||
args.proxy_path="http://127.0.0.1:6787"
|
||||
args.assets_path="/usr/share/yunohost/admin"
|
||||
|
||||
[default.curl_tests]
|
||||
# If needed, we can add a preinstall step, as shown here:
|
||||
# https://github.com/YunoHost/package_check
|
||||
|
||||
#admin.path = "/"
|
||||
admin.expect_title = "YunoHost Admin"
|
||||
|
||||
admin_css.path = "/assets/UserCreate-18b2103e.css"
|
||||
admin_css.expect_content = ".custom-select[data-v-0d75331f]{flex-basis:40%}"
|
||||
|
|
Loading…
Reference in a new issue