From 9f05482862506cc946d4e65ec82b0e85bca7efe0 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 5 Dec 2023 01:08:20 +0100 Subject: [PATCH] Zbmlgrerg --- README.md | 2 +- README_fr.md | 2 +- conf/nginx-redirect.conf | 2 +- manifest.toml | 4 +++- scripts/install | 4 ++-- tests.toml | 12 ++++++++---- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f522bf8..e813f34 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ In technical terms: this app only adds a NGINX configuration snippet with either **Shipped version:** 2.0~ynh1 ## Documentation and resources -* Official app website: +* Official app website: * YunoHost Store: * Report a bug: diff --git a/README_fr.md b/README_fr.md index ddb7971..f333130 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,7 +26,7 @@ En terme technique: cette app se contente de rajouter le morceau de configuratio **Version incluse :** 2.0~ynh1 ## Documentations et ressources -* Site officiel de l’app : +* Site officiel de l’app : * YunoHost Store: * Signaler un bug : diff --git a/conf/nginx-redirect.conf b/conf/nginx-redirect.conf index 8ef882a..731c42d 100644 --- a/conf/nginx-redirect.conf +++ b/conf/nginx-redirect.conf @@ -1,3 +1,3 @@ -location __PATH__/ { +location __PATH__ { return 302 __TARGET__$request_uri; } diff --git a/manifest.toml b/manifest.toml index 5c85b64..f9a59d6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -11,7 +11,7 @@ maintainers = [] [upstream] license = "AGPL-3.0-or-later" -website = "https://github.com/YunoHost-Apps/redirect_ynh" +website = "https://en.wikipedia.org/wiki/Reverse_proxy" [integration] yunohost = ">= 11.2" @@ -37,6 +37,7 @@ ram.runtime = "50M" type = "select" choices.redirect = "Explicit redirection (HTTP 302). Redirect people to another URL." choices.reverseproxy = "Reverse-proxy (nginx proxy_pass). Expose an app, typically that you manually installed (with or without Docker) locally or an another machine." + default = "redirect" [install.target] ask.en = "Target" @@ -45,6 +46,7 @@ ram.runtime = "50M" example = "http://127.0.0.1:1312/" [install.init_main_permission] + type = "group" default = "visitors" [resources] diff --git a/scripts/install b/scripts/install index b33ed9e..979fcfd 100644 --- a/scripts/install +++ b/scripts/install @@ -11,8 +11,8 @@ source /usr/share/yunohost/helpers # Avoid uncrypted remote destination with reverse proxy mode # Indeed the SSO send the password in all requests in HTTP headers url_regex='^(http://(127\.[0-9]+\.[0-9]+\.[0-9]+|localhost)|https://.*)(:[0-9]+)?(/.*)?$' -[[ "$redirect_type" = "reverseproxy" ]] && [[ ! $redirect_path =~ $url_regex ]] && ynh_die \ -"For secure reason, you can't use an unencrypted http remote destination coupled with ssowat for your reverse proxy: $redirect_path" 1 +[[ "$redirect_type" = "reverseproxy" ]] && [[ ! "$target" =~ $url_regex ]] && ynh_die \ +"For secure reason, you can't use an unencrypted http remote destination coupled with ssowat for your reverse proxy: $target" 1 #================================================= # CONFIGURE NGINX diff --git a/tests.toml b/tests.toml index 08e60d4..a92406c 100644 --- a/tests.toml +++ b/tests.toml @@ -3,18 +3,22 @@ test_format = 1.0 [default] args.redirect_type = "redirect" - args.target = "https://fr.wikipedia.org" + args.target = "http://127.0.0.1" test_upgrade_from.09cf1c6b.name = "v1 era" + test_upgrade_from.09cf1c6b.args.domain = "domain.tld" test_upgrade_from.09cf1c6b.args.redirect_type = "visible_302" - test_upgrade_from.09cf1c6b.args.redirect_path = "https://fr.wikipedia.org" + test_upgrade_from.09cf1c6b.args.redirect_path = "http://127.0.0.1" [reverseproxy] args.redirect_type = "reverseproxy" - args.target = "http://127.0.0.1:80" + args.target = "http://127.0.0.1" + + exclude = ["install.private", "install.multi", "backup_restore"] test_upgrade_from.09cf1c6b.name = "v1 era" + test_upgrade_from.09cf1c6b.args.domain = "domain.tld" test_upgrade_from.09cf1c6b.args.redirect_type = "proxy_public" - test_upgrade_from.09cf1c6b.args.redirect_path = "http://127.0.0.1:80" + test_upgrade_from.09cf1c6b.args.redirect_path = "http://127.0.0.1"