1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jellyseerr_ynh.git synced 2024-09-03 19:26:18 +02:00

try installing in a subpath

This commit is contained in:
Thomas 2024-03-09 18:04:07 +01:00 committed by GitHub
parent 5a1273111b
commit 4e1c5b6e1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 9 deletions

View file

@ -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 '</head>' '<script language="javascript">(()=>{var t="$app";let e=history.pushState;history.pushState=function a(){arguments[2]&&!arguments[2].startsWith("/"+t)&&(arguments[2]="/"+t+arguments[2]);let s=e.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),s};let a=history.replaceState;history.replaceState=function e(){arguments[2]&&!arguments[2].startsWith("/"+t)&&(arguments[2]="/"+t+arguments[2]);let s=a.apply(this,arguments);return window.dispatchEvent(new Event("replacestate")),s},window.addEventListener("popstate",()=>{console.log("popstate")})})();</script></head>';
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;
}
}

View file

@ -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"