Yunohost panel in parent location block, assets/try_files defined from bash

This commit is contained in:
selfhoster1312 2023-01-10 19:03:08 +01:00
parent d6838b36d3
commit a47af1ed63
2 changed files with 19 additions and 12 deletions

View file

@ -12,8 +12,6 @@ location @__NAME__--proxy {
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
more_clear_input_headers 'Accept-Encoding'; more_clear_input_headers 'Accept-Encoding';
} }
@ -21,6 +19,9 @@ location @__NAME__--proxy {
__REDIRECT_BLOCK__ __REDIRECT_BLOCK__
location __PATH_URL_SLASH__ { location __PATH_URL_SLASH__ {
alias __ASSETS_PATH__; # Include SSOWAT user panel.
try_files $uri @__NAME__--proxy; include conf.d/yunohost_panel.conf.inc;
__ASSETS_ALIAS__
__TRY_FILES__
} }

View file

@ -26,9 +26,12 @@ rp_validate_proxy_path() {
# Verify that the requested assets path is valid # Verify that the requested assets path is valid
# - is a local folder # - is a local folder
# - ends with a / # - ends with a /
# Sets the alias line for serving static files,
# and the try_files line for trying those static files first
rp_validate_assets_path() { rp_validate_assets_path() {
if [[ "$assets_path" = "" ]]; then if [[ "$assets_path" = "" ]]; then
assets_path="/dev/null" assets_alias="# No static files to serve"
try_files="try_files /dev/null @${app}--proxy;"
else else
if [ ! -d "$assets_path" ]; then if [ ! -d "$assets_path" ]; then
ynh_die "Requested assets path "$assets_path" does not exist" 1 ynh_die "Requested assets path "$assets_path" does not exist" 1
@ -38,6 +41,9 @@ rp_validate_assets_path() {
# Append missing trailing / # Append missing trailing /
assets_path=""${assets_path}"/" assets_path=""${assets_path}"/"
fi fi
assets_alias="alias $assets_path;"
try_files="try_files \$uri \$uri/ @${app}--proxy;"
fi fi
} }