From 4e1c5b6e1bbfbffacb61265c335c2f57e9b3909f Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Sat, 9 Mar 2024 18:04:07 +0100 Subject: [PATCH] try installing in a subpath --- conf/nginx.conf | 40 +++++++++++++++++++++++++++++++--------- manifest.toml | 5 +++++ 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index f8e3865..655d75b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,15 +1,37 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__/ { +location ^~ __PATH__/ { + set $app '__PATH__'; - proxy_pass http://127.0.0.1:__PORT__/; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $host; - proxy_redirect default; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Host $server_name; - proxy_set_header X-Forwarded-Proto $scheme; + # Remove /overseerr path to pass to the app + rewrite ^/__PATH__/?(.*)$ /$1 break; + proxy_pass http://127.0.0.1:__PORT__; + + # Redirect location headers + proxy_redirect ^ /$app; + proxy_redirect /setup /$app/setup; + proxy_redirect /login /$app/login; + + # Sub filters to replace hardcoded paths + proxy_set_header Accept-Encoding ""; + sub_filter_once off; + sub_filter_types *; + #https://stackoverflow.com/questions/19700871/how-to-inject-custom-content-via-nginx + sub_filter '' ''; + sub_filter 'href="/"' 'href="/$app"'; + sub_filter 'href="/login"' 'href="/$app/login"'; + sub_filter 'href:"/"' 'href:"/$app"'; + sub_filter '\/_next' '\/$app\/_next'; + sub_filter '/_next' '/$app/_next'; + sub_filter '/api/v1' '/$app/api/v1'; + sub_filter '/login/plex/loading' '/$app/login/plex/loading'; + sub_filter '/images/' '/$app/images/'; + sub_filter '/android-' '/$app/android-'; + sub_filter '/apple-' '/$app/apple-'; + sub_filter '/favicon' '/$app/favicon'; + sub_filter '/logo_' '/$app/logo_'; + sub_filter '/site.webmanifest' '/$app/site.webmanifest'; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; -} +} \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index 4f18b05..b2c682c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -29,6 +29,11 @@ ram.runtime = "50M" [install.domain] type = "domain" + [install.path] + type = "path" + default = "/example" + + [install.init_main_permission] type = "group" default = "visitors"