From c46557ee7ece1a121ad2480b69b438222901d15f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 2 Feb 2021 12:48:54 +0100 Subject: [PATCH] Fix --- conf/nginx.conf | 19 ++++++------------- scripts/upgrade | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 8f529a2..4ff7bc7 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -11,23 +11,16 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } + # BOSH location = __PATH__/http-bind { - proxy_pass http://localhost:5290/http-bind; - proxy_redirect off; + proxy_pass "http://localhost:5290/http-bind"; + proxy_http_version 1.1; proxy_set_header Host $host; 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 X-Forwarded-Host $server_name; - proxy_set_header X-Forwarded-Port $server_port; - - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection “upgrade”; - } - - # CORS - location ~ .(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ { - more_set_headers 'Access-Control-Allow-Origin: "*"'; # Decide here whether you want to allow all or only a particular domain - root __FINALPATH__/; # Properly set the path here + proxy_buffering off; + tcp_nodelay on; } # Include SSOWAT user panel. diff --git a/scripts/upgrade b/scripts/upgrade index 3e30c63..e75be60 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -26,6 +26,17 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# If final_path doesn't exist, create it +if [ -z "$final_path" ]; then + final_path=/var/www/$app + ynh_app_setting_set --app=$app --key=final_path --value=$final_path +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -48,8 +59,11 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=4 + # Remove the app directory securely + ynh_secure_remove --file="$final_path" + # Download, the source from sources folder - mkdir -p $final_path && cp -a ../sources/* $final_path + cp -a ../sources/* $final_path ynh_replace_string --match_string="__DOMAIN____PATH__" --replace_string="$domain$path_url" --target_file="$final_path/index.html" fi