Skip to content

Instantly share code, notes, and snippets.

@spiritualized
Last active September 3, 2024 21:45
Show Gist options
  • Select an option

  • Save spiritualized/c87fc97148e279b4c59c6fb51c1a7050 to your computer and use it in GitHub Desktop.

Select an option

Save spiritualized/c87fc97148e279b4c59c6fb51c1a7050 to your computer and use it in GitHub Desktop.
Wizarr reverse proxy nginx config for a URL prefix
# Nginx reverse proxy config for wizarr in docker on a URL prefix
# Use docker's DNS
resolver 127.0.0.11;
# wizarr
location /wizarr/ {
set $upstream_app wizarr;
proxy_pass http://$upstream_app:5690;
# Remove /wizarr path to pass to the app
rewrite ^/wizarr/?(.*)$ /$1 break;
# Redirect location headers
proxy_redirect ^ /$upstream_app;
proxy_redirect /admin /$upstream_app/admin;
proxy_redirect /login /$upstream_app/login;
# Sub filters to replace hardcoded paths
#proxy_set_header Accept-Encoding "";
sub_filter_once off;
sub_filter_types *;
sub_filter '/static/' '/$upstream_app/static/';
sub_filter 'href="/"' 'href="/$upstream_app"';
sub_filter 'action="/' 'action="/$upstream_app/';
sub_filter 'hx-post="/' 'hx-post="/$upstream_app/';
sub_filter 'hx-get="/' 'hx-get="/$upstream_app/';
sub_filter '"/scan?plex_url="' '"/$upstream_app/scan?plex_url="';
sub_filter '"/jf-scan?plex_url="' '"/$upstream_app/jf-scan?plex_url="';
sub_filter '"/scan-specific"' '"/$upstream_app/scan-specific"';
sub_filter '"/jf-scan-specific"' '"/$upstream_app/jf-scan-specific"';
}
@shanester64
Copy link

I found your code via the wizarr discord server. My NGINX server does not run in a docker, but on a different ubuntu server in the same LAN.
When I try to access the wizarr URL via WAN, I get a white screen. All my other *arr apps work as they support URL base configurations.
Looking at my nginx logs, it is looking for files in the "/usr/share/nginx/html" directory of my proxy server instead of the Wizarr server. Not sure how to fix this in the nginx site config (sites-available/default). Any suggestions would be appreciated!!

2024/08/29 22:51:38 [error] 276139#276139: *965 open() "/usr/share/nginx/html/assets/index-85ade532.js" failed (2: No such file or directory), client: 192.168.0.1, server: MYDOMAIN.COM, request: "GET /assets/index-85ade532.js HTTP/1.1", host: "MYDOMAIN.COM", referrer: "https://MYDOMAIN.COM/wizarr"
2024/08/29 22:51:38 [error] 276139#276139: *965 open() "/usr/share/nginx/html/assets/index-77215d84.css" failed (2: No such file or directory), client: 192.168.0.1, server: MYDOMAIN.COM, request: "GET /assets/index-77215d84.css HTTP/1.1", host: "MYDOMAIN.COM", referrer: "https://MYDOMAIN.COM/wizarr"
2024/08/29 22:51:38 [error] 276139#276139: *968 open() "/usr/share/nginx/html/manifest.webmanifest" failed (2: No such file or directory), client: 192.168.0.1, server: MYDOMAIN.COM, request: "GET /manifest.webmanifest HTTP/1.1", host: "MYDOMAIN.COM", referrer: "https://MYDOMAIN.COM/wizarr"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment