mirror of
https://github.com/YunoHost-Apps/jellyseerr_ynh.git
synced 2024-09-03 19:26:18 +02:00
36 lines
1.8 KiB
Nginx Configuration File
36 lines
1.8 KiB
Nginx Configuration File
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
|
location ^~ __PATH__/ {
|
|
set $app '__PATH__';
|
|
|
|
# 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_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;
|
|
}
|