Coder Social home page Coder Social logo

Run overseerr on subpath, Base URL about overseerr HOT 54 OPEN

sct avatar sct commented on July 29, 2024 94
Run overseerr on subpath, Base URL

from overseerr.

Comments (54)

sct avatar sct commented on July 29, 2024 12

And to be clear, we are still looking into building this support into Overseerr directly. But ETA for that is still unknown.

from overseerr.

ElMoselYEE avatar ElMoselYEE commented on July 29, 2024 7

Would really love this feature and am willing to contribute.

I've implemented this feature in my private repo (see PR: https://github.com/ElMoselYEE/overseerr/pull/1) but it only works when using build-time variables; I'm hitting a blocker with how to achieve this at runtime. @mmgoodnow your comments about dynamic frontend hydration seem promising although I'm not really sure how to implement such a workflow.

from overseerr.

mmozeiko avatar mmozeiko commented on July 29, 2024 5

Changing base path in next.config.js is only part of solution. It works and makes app to listen on correct base path (this is a build time setting). I've tried it and it works.
But you need to change also all XHR requests in frontend from /api to $base/api. This involves all calls to axios.get/post and useSWR in frontend code.

I was planning to do this, but was busy past few weeks finishing #538.
My plan was to have build setting in some config file that gets used in both frontend and server. That would be good enough for my usage. Doing this as runtime settings would be much much more work to figure out how to do it.

But if somebody is doing this, then let me know and I won't look at this.

from overseerr.

markus-li avatar markus-li commented on July 29, 2024 5

After a nice chat with @danshilm at Discord I revisited my sub_filter rules to make sure Web Push and PWA was working, it turned out they needed some additional tuning. I don't know if it works on iPhone, but it works in Chrome on my Samsung phone. If Overseerr would run in a subfolder (just about anything so that rewrites can go against the subfolder instead of /) by default this could probably be shortened to a few lines.

Due to the many special corner cases etc this is probably very brittle and could break at next update, but this is what I came up with:

location ^~ /pods/direct/overseerr {
    ## Set environment variables for use with SSO
    set $service_unit "podman-overseerr";
    set $service_name_pretty "Overseerr";
    
    set $app 'pods/direct/overseerr';
    set $app_esc 'pods\/direct\/overseerr';

    # Remove /pods/direct/overseerr path to pass to the app
    rewrite ^/pods/direct/overseerr/?(.*)$ /$1 break;
    proxy_pass http://127.0.0.1:5055; # NO TRAILING SLASH

    # 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 *;
    
    # HREF
    sub_filter 'href="/"' 'href="/$app/"';
    sub_filter 'href="/login"' 'href="/$app/login"';
    sub_filter 'href:"/"' 'href:"/$app/"'; 

    ## Capture some things which shouldn't change
    sub_filter '.id,"/' '.id,"/';
    sub_filter '"/settings/main' '"/settings/main';
    sub_filter '"/settings/password' '"/settings/password';
    sub_filter '"/settings/permissions' '"/settings/permissions';
    sub_filter '"/settings/notifications/email' '"/$app/settings/notifications/email';
    sub_filter 'webPushEnabled?"/settings/notifications/webpush"' 'webPushEnabled?"/settings/notifications/webpush"';
    sub_filter '"/settings/notifications/webpush' '"/$app/settings/notifications/webpush';
    sub_filter '"/settings/notifications/pushbullet' '"/$app/settings/notifications/pushbullet';
    sub_filter '"/settings/notifications/pushover' '"/$app/settings/notifications/pushover';
    # sub_filter '"/settings/notifications/pushover' '"/settings/notifications/pushover';
    sub_filter '"/settings/notifications' '"/settings/notifications';
    
    ## Now the remaining settings paths are ok to change
    sub_filter '"/settings' '"/$app/settings';
    
    ## Default filters:
    sub_filter '\/_next' '\/$app_esc\/_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/';
    
    ## Route-specific filters:
    sub_filter '"/sw.js"' '"/$app/sw.js"';
    sub_filter '"/offline.html' '"/$app/offline.html';
    sub_filter '"/android-' '"/$app/android-';
    sub_filter '"/apple-' '"/$app/apple-';
    sub_filter '"/favicon' '"/$app/favicon';
    sub_filter '"/logo_' '"/$app/logo_';
    sub_filter '"/profile' '"/$app/profile';
    sub_filter '"/users' '"/$app/users';
    sub_filter '"/movie' '"/$app/movie';
    sub_filter '"/tv' '"/$app/tv';
    ### These are needed for request management
    # It looks like this one rule can be used intead of the below 3
    sub_filter '="/".concat' '="/$app/".concat';
    # sub_filter 't="/".concat(w,"/").concat(y,"?manage=1"' 't="/$app/".concat(w,"/").concat(y,"?manage=1"';
    # sub_filter 's="/".concat(N,"/").concat(y,"?manage=1"' 's="/$app/".concat(N,"/").concat(y,"?manage=1"';
    # sub_filter 't="/".concat(b,"/").concat(y,"?manage=1"' 't="/$app/".concat(b,"/").concat(y,"?manage=1"';
    ###

    # Fix WebPush action URL:
    sub_filter 'actionUrl: payload' 'actionUrl: \'/$app\' + payload';
   
    sub_filter '"/person' '"/$app/person';
    sub_filter '"/collection' '"/$app/collection';
    sub_filter '"/discover' '"/$app/discover';
    sub_filter '"/requests' '"/$app/requests';
    sub_filter '"/issues' '"/$app/issues';
    sub_filter '"/site.webmanifest' '"/$app/site.webmanifest';
    # Setting settings paths so that they don't match the generic replace
    
    # For routes in /profile
    sub_filter 'route:"/settings/password' 'route:"/settings/password';
    sub_filter 'regex:/^\/settings\/password' 'regex:/^\/settings\/password';
    sub_filter 'route:"/settings/permissions' 'route:"/settings/permissions';
    sub_filter 'regex:/^\/settings\/permissions' 'regex:/^\/settings\/permissions';
    sub_filter 'route:"/settings/main",regex:/\/settings(\/main)?' 'route:"/settings/main",regex:/\/settings(\/main)?';            
    sub_filter 'route:"/settings/notifications/webpush",regex:/\/settings\/notifications\/webpush/,' 'route:"/settings/notifications/webpush",regex:/\/settings\/notifications\/webpush/,';
    sub_filter 'route:"/settings/notifications/pushbullet",regex:/\/settings\/notifications\/pushbullet/}' 'route:"/settings/notifications/pushbullet",regex:/\/settings\/notifications\/pushbullet/}';
    sub_filter 'route:"/settings/notifications/pushover",regex:/\/settings\/notifications\/pushover/}' 'route:"/settings/notifications/pushover",regex:/\/settings\/notifications\/pushover/}';
    sub_filter 'route:"/settings/notifications' 'route:"/$app/settings/notifications';
    sub_filter 'regex:/^\/settings\/notifications' 'regex:/^\/$app_esc\/settings\/notifications';
    
    # Generic route and regex replace
    sub_filter 'route:"/' 'route:"/$app/';
    sub_filter 'regex:/^\/' 'regex:/^\/$app_esc\/';
    sub_filter 'regex:/\/' 'regex:/\/$app_esc\/';
}
# code: language=nginx insertSpaces=true tabSize=4

from overseerr.

samwiseg0 avatar samwiseg0 commented on July 29, 2024 3

All,

There is an unsupported workaround in the overseerr docs. Please use it at your own risk! This could break at any point. No support will be given for this workaround.

If you are having issues please verify that it is reproducible when accessing overseerr directly!

https://docs.overseerr.dev/extending-overseerr/reverse-proxy-examples#nginx

from overseerr.

joeknock90 avatar joeknock90 commented on July 29, 2024 3

In case anyone is interested for a way to do this with Traefik, I've got it working with the following:

Setup a supplemental nginx container called overseerr-web that uses the setup from the documentation for a subpath (#1114

Then gave it the following labels

labels:
      traefik.docker.network: 'web'
      traefik.enable: 'true'
      traefik.http.routers.overseerr-web.entrypoints: 'websecure'
      traefik.http.routers.overseerr-web.rule: 'Host(`media.example.net`) && PathPrefix(`/overseerr`)'
      traefik.http.routers.overseerr-web.service: 'overseerr-web'
      traefik.http.services.overseerr-web.loadbalancer.server.port: '80'
      # Fix trailing slash
      traefik.http.middlewares.strip-prefix.chain.middlewares: 'strip-prefix-1,strip-prefix-2'
      traefik.http.middlewares.strip-prefix-1.redirectregex.regex: '^(https?://[^/]+/[a-z0-9_]+)$$'
      traefik.http.middlewares.strip-prefix-1.redirectregex.replacement: '$${1}/'
      traefik.http.middlewares.strip-prefix-1.redirectregex.permanent: 'true'
      traefik.http.middlewares.strip-prefix-2.stripprefixregex.regex: '/[a-z0-9_]+'

Of course I've sanitized some labels, but this is currently working for me. I am personally using the PathPrefix "/request" and have adjusted the nginx file accordingly.

Hope this helps someone.

from overseerr.

SteffanCline avatar SteffanCline commented on July 29, 2024 3

Are there any configs for this to work in Apache and base URL? domain.tld/overseerr

from overseerr.

blixten85 avatar blixten85 commented on July 29, 2024 3

And to be clear, we are still looking into building this support into Overseerr directly. But ETA for that is still unknown.

Still no progression?

from overseerr.

sct avatar sct commented on July 29, 2024 2

Have to agree with this, it's really only usable for me to tinker with once in awhile. Can't have any other users try it out without letting it through the proxy.

You could always run it through a proxy on a subdomain, if your setup permits.

Subpath will take some time to figure out. Might be awhile :(

from overseerr.

ramkrishna757575 avatar ramkrishna757575 commented on July 29, 2024 2

After a nice chat with @danshilm at Discord I revisited my sub_filter rules to make sure Web Push and PWA was working, it turned out they needed some additional tuning. I don't know if it works on iPhone, but it works in Chrome on my Samsung phone. If Overseerr would run in a subfolder (just about anything so that rewrites can go against the subfolder instead of /) by default this could probably be shortened to a few lines.

Due to the many special corner cases etc this is probably very brittle and could break at next update, but this is what I came up with:

location ^~ /pods/direct/overseerr {
    ## Set environment variables for use with SSO
    set $service_unit "podman-overseerr";
    set $service_name_pretty "Overseerr";
    
    set $app 'pods/direct/overseerr';
    set $app_esc 'pods\/direct\/overseerr';

    # Remove /pods/direct/overseerr path to pass to the app
    rewrite ^/pods/direct/overseerr/?(.*)$ /$1 break;
    proxy_pass http://127.0.0.1:5055; # NO TRAILING SLASH

    # 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 *;
    
    # HREF
    sub_filter 'href="/"' 'href="/$app/"';
    sub_filter 'href="/login"' 'href="/$app/login"';
    sub_filter 'href:"/"' 'href:"/$app/"'; 

    ## Capture some things which shouldn't change
    sub_filter '.id,"/' '.id,"/';
    sub_filter '"/settings/main' '"/settings/main';
    sub_filter '"/settings/password' '"/settings/password';
    sub_filter '"/settings/permissions' '"/settings/permissions';
    sub_filter '"/settings/notifications/email' '"/$app/settings/notifications/email';
    sub_filter 'webPushEnabled?"/settings/notifications/webpush"' 'webPushEnabled?"/settings/notifications/webpush"';
    sub_filter '"/settings/notifications/webpush' '"/$app/settings/notifications/webpush';
    sub_filter '"/settings/notifications/pushbullet' '"/$app/settings/notifications/pushbullet';
    sub_filter '"/settings/notifications/pushover' '"/$app/settings/notifications/pushover';
    # sub_filter '"/settings/notifications/pushover' '"/settings/notifications/pushover';
    sub_filter '"/settings/notifications' '"/settings/notifications';
    
    ## Now the remaining settings paths are ok to change
    sub_filter '"/settings' '"/$app/settings';
    
    ## Default filters:
    sub_filter '\/_next' '\/$app_esc\/_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/';
    
    ## Route-specific filters:
    sub_filter '"/sw.js"' '"/$app/sw.js"';
    sub_filter '"/offline.html' '"/$app/offline.html';
    sub_filter '"/android-' '"/$app/android-';
    sub_filter '"/apple-' '"/$app/apple-';
    sub_filter '"/favicon' '"/$app/favicon';
    sub_filter '"/logo_' '"/$app/logo_';
    sub_filter '"/profile' '"/$app/profile';
    sub_filter '"/users' '"/$app/users';
    sub_filter '"/movie' '"/$app/movie';
    sub_filter '"/tv' '"/$app/tv';
    ### These are needed for request management
    # It looks like this one rule can be used intead of the below 3
    sub_filter '="/".concat' '="/$app/".concat';
    # sub_filter 't="/".concat(w,"/").concat(y,"?manage=1"' 't="/$app/".concat(w,"/").concat(y,"?manage=1"';
    # sub_filter 's="/".concat(N,"/").concat(y,"?manage=1"' 's="/$app/".concat(N,"/").concat(y,"?manage=1"';
    # sub_filter 't="/".concat(b,"/").concat(y,"?manage=1"' 't="/$app/".concat(b,"/").concat(y,"?manage=1"';
    ###

    # Fix WebPush action URL:
    sub_filter 'actionUrl: payload' 'actionUrl: \'/$app\' + payload';
   
    sub_filter '"/person' '"/$app/person';
    sub_filter '"/collection' '"/$app/collection';
    sub_filter '"/discover' '"/$app/discover';
    sub_filter '"/requests' '"/$app/requests';
    sub_filter '"/issues' '"/$app/issues';
    sub_filter '"/site.webmanifest' '"/$app/site.webmanifest';
    # Setting settings paths so that they don't match the generic replace
    
    # For routes in /profile
    sub_filter 'route:"/settings/password' 'route:"/settings/password';
    sub_filter 'regex:/^\/settings\/password' 'regex:/^\/settings\/password';
    sub_filter 'route:"/settings/permissions' 'route:"/settings/permissions';
    sub_filter 'regex:/^\/settings\/permissions' 'regex:/^\/settings\/permissions';
    sub_filter 'route:"/settings/main",regex:/\/settings(\/main)?' 'route:"/settings/main",regex:/\/settings(\/main)?';            
    sub_filter 'route:"/settings/notifications/webpush",regex:/\/settings\/notifications\/webpush/,' 'route:"/settings/notifications/webpush",regex:/\/settings\/notifications\/webpush/,';
    sub_filter 'route:"/settings/notifications/pushbullet",regex:/\/settings\/notifications\/pushbullet/}' 'route:"/settings/notifications/pushbullet",regex:/\/settings\/notifications\/pushbullet/}';
    sub_filter 'route:"/settings/notifications/pushover",regex:/\/settings\/notifications\/pushover/}' 'route:"/settings/notifications/pushover",regex:/\/settings\/notifications\/pushover/}';
    sub_filter 'route:"/settings/notifications' 'route:"/$app/settings/notifications';
    sub_filter 'regex:/^\/settings\/notifications' 'regex:/^\/$app_esc\/settings\/notifications';
    
    # Generic route and regex replace
    sub_filter 'route:"/' 'route:"/$app/';
    sub_filter 'regex:/^\/' 'regex:/^\/$app_esc\/';
    sub_filter 'regex:/\/' 'regex:/\/$app_esc\/';
}
# code: language=nginx insertSpaces=true tabSize=4

This seems to be working. Thanks a lot 😃

from overseerr.

dieg0nob avatar dieg0nob commented on July 29, 2024 2

Are there any configs for this to work in Apache and base URL? domain.tld/overseerr

i'm very interesting in this!!! have you find a solution with apache ?

from overseerr.

anonyme123 avatar anonyme123 commented on July 29, 2024 1

The lack of this feature is preventing Overseerr from being made available to many Plex VPS providers.
Screen Shot 2021-11-04 at 21 56 52

from overseerr.

stale avatar stale commented on July 29, 2024 1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from overseerr.

rix1337 avatar rix1337 commented on July 29, 2024 1

For the moment this Workaround using nginx is still valid:
#1114

from overseerr.

sct avatar sct commented on July 29, 2024 1

Unfortunately with version 1.30.0 of Overseerr the workaround in the documentation for this has broken: https://docs.overseerr.dev/extending-overseerr/reverse-proxy

I had to revert back to 1.29.1 to get it working again.

There is already a fix. Check out the support channel in our discord.

from overseerr.

BaldissaraMatheus avatar BaldissaraMatheus commented on July 29, 2024 1

After a nice chat with @danshilm at Discord I revisited my sub_filter rules to make sure Web Push and PWA was working, it turned out they needed some additional tuning. I don't know if it works on iPhone, but it works in Chrome on my Samsung phone. If Overseerr would run in a subfolder (just about anything so that rewrites can go against the subfolder instead of /) by default this could probably be shortened to a few lines.

Due to the many special corner cases etc this is probably very brittle and could break at next update, but this is what I came up with:

location ^~ /pods/direct/overseerr {
    ## Set environment variables for use with SSO
    set $service_unit "podman-overseerr";
    set $service_name_pretty "Overseerr";
    
    set $app 'pods/direct/overseerr';
    set $app_esc 'pods\/direct\/overseerr';
    ...

This configuration didn't work well for me. When requesting a movie, overseerr seems to be prefixing radarr's root folder with the base path as well, causing the Missing Root Folder error in radarr

Edit: Removing sub_filter '"/movie' '"/$app/movie'; seems to fix the issue

from overseerr.

adamskoog avatar adamskoog commented on July 29, 2024

Have to agree with this, it's really only usable for me to tinker with once in awhile. Can't have any other users try it out without letting it through the proxy.

from overseerr.

jluis2k10 avatar jluis2k10 commented on July 29, 2024

I'd love to make this work as well

from overseerr.

adamskoog avatar adamskoog commented on July 29, 2024

Have to agree with this, it's really only usable for me to tinker with once in awhile. Can't have any other users try it out without letting it through the proxy.

You could always run it through a proxy on a subdomain, if your setup permits.

Subpath will take some time to figure out. Might be awhile :(

Kind of a bummer, I don't currently have the option to do a subdomain without a bit of work. Not in the cards at the moment. Look forward to where this goes though.

from overseerr.

ankarhem avatar ankarhem commented on July 29, 2024

Isn't this just a matter of setting the baseurl in next config and doing namespace in express? Can you elaborate on what is hindering this @sct ?

from overseerr.

flying-sausages avatar flying-sausages commented on July 29, 2024

iirc next does not really support setting dynamic baseurls in runtime, so it would be have to built with it already set.

from overseerr.

ankarhem avatar ankarhem commented on July 29, 2024

Oh, yeah that's true. So the solution for us would be to prepend every use we have of express, links etc with an env variable we can pass in to the docker image for instance?

from overseerr.

flying-sausages avatar flying-sausages commented on July 29, 2024

Sounds a little hacky, unless you have something centralized that would generate links already. I didn't check your codebase yet.

I'd personally settle with setting it at build-time, it's not often you will change this i feel.

from overseerr.

flying-sausages avatar flying-sausages commented on July 29, 2024

But if somebody is doing this, then let me know and I won't look at this.

Looks like no one is ha

from overseerr.

mmgoodnow avatar mmgoodnow commented on July 29, 2024

As far as I understand it, setting the base url at build time doesn't work super well with Docker because generally a base url change will require the frontend to be recompiled, which means that you'd either have to

  • do frontend compilation as part of the container entry point (at runtime), or
  • require that anybody changing their base url builds their own docker container.

Neither is very appealing in the long run, though they're both far better in the short term than not being able to use the app at all (for many of our use-cases).

To be able to set the base url at runtime, you'd need a couple things:

  • to be able to serve up the static files (js bundles, index.html, images, etc.) from a dynamic base url at runtime (server restart would be fine). In a normal non-SSR app this would be pretty easy, not sure how it changes with Next.

  • to know, in frontend code, what base url it's currently being served from (to prefix api calls).

  • Maybe next could dynamically hydrate the frontend with the base url that it's serving it from somehow? Not sure how that would affect asset paths like images and such, but it would make api call prefixing pretty simple.

from overseerr.

RageInvader avatar RageInvader commented on July 29, 2024

I have all my apps setup using subfolders, I can't really use this without suborder reverse proxy, as I already have my home server on a subdomain.

from overseerr.

brettpetch avatar brettpetch commented on July 29, 2024

Any chance this is going to be looked at again? I notice that it's been removed from the roadmap.

/b

from overseerr.

samwiseg0 avatar samwiseg0 commented on July 29, 2024

@brettpetch Please see the comment right above yours. #274 (comment). Please do not post in issues asking for status updates. We are diligent in updating issues as things change. We provide no ETAs.

from overseerr.

stale avatar stale commented on July 29, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from overseerr.

stale avatar stale commented on July 29, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from overseerr.

flying-sausages avatar flying-sausages commented on July 29, 2024

Hide this comment pls

from overseerr.

TheCatLady avatar TheCatLady commented on July 29, 2024

@ElMoselYEE Feel free to join us on Discord to discuss!

from overseerr.

megamit avatar megamit commented on July 29, 2024

Would really love this feature and am willing to contribute.

I've implemented this feature in my private repo (see PR: ElMoselYEE#1) but it only works when using build-time variables; I'm hitting a blocker with how to achieve this at runtime. @mmgoodnow your comments about dynamic frontend hydration seem promising although I'm not really sure how to implement such a workflow.

I also would really love this feature. I hope you dont mind but i am taking a swing at making this configurable without needing a rebuild.

from overseerr.

mmgoodnow avatar mmgoodnow commented on July 29, 2024

Oh, I forgot to ever reply to this. I was sort of picturing a situation where, when index.html is requested, you read the file and splice a script tag into it:

<script>
    window.baseUrl = ${process.env.BASE_URL}
</script>

Then after that interpolation you can send it off to the client who can read from that window var.

from overseerr.

megamit avatar megamit commented on July 29, 2024

Yep that's essentially what i have done except instead of using a global script it is using Runtime Configuration

from overseerr.

adamskoog avatar adamskoog commented on July 29, 2024

I did this with my app I've been working on (not Next, just React) - not sure if it would help you figure something out: https://www.freecodecamp.org/news/how-to-implement-runtime-environment-variables-with-create-react-app-docker-and-nginx-7f9d42a91d70/

This would be the full implementation for what @mmgoodnow posted above.

from overseerr.

SteffanCline avatar SteffanCline commented on July 29, 2024

I see all these mentions of people implementing hacks etc. I notice on the docker site, there are versions by different authors available. Anyone know if there's a hack for Apache or another docker version that does offer this? I really need it.

from overseerr.

caio1007 avatar caio1007 commented on July 29, 2024

hi ,I installed the overseerr subfolder (https://docs.overseerr.dev/extending-overseerr/reverse-proxy) and it's giving this error, I use overseerr installed via docker on a raspberry pi 4 with dietpi system...>>>>

sudo service nginx restart
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

sudo nginx -t
nginx: [emerg] unknown directive "sub_filter_once" in /etc/nginx/sites-dietpi/over.conf:15
nginx: configuration file /etc/nginx/nginx.conf test failed

from overseerr.

stale avatar stale commented on July 29, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from overseerr.

dansmith01 avatar dansmith01 commented on July 29, 2024

Chiming in to clear the stale tag. This would be a really helpful feature!

from overseerr.

dwk001 avatar dwk001 commented on July 29, 2024

from overseerr.

SteffanCline avatar SteffanCline commented on July 29, 2024

I too would be willing to pay for this feature. I trust it's not a walk in the park the definitely feasible given the number of other *rr services that do this already.

from overseerr.

dwk001 avatar dwk001 commented on July 29, 2024

from overseerr.

ftc2 avatar ftc2 commented on July 29, 2024

@ElMoselYEE wrote:

I've implemented this feature in my private repo (see PR: https://github.com/ElMoselYEE/overseerr/pull/1) but it only works when using build-time variables

your fork is gone :(
does anyone else have this working somewhere before i try to figure it out myself?

@mmozeiko wrote:

Changing base path in next.config.js is only part of solution. It works and makes app to listen on correct base path (this is a build time setting). I've tried it and it works. But you need to change also all XHR requests in frontend from /api to $base/api. This involves all calls to axios.get/post and useSWR in frontend code.

from overseerr.

harb88 avatar harb88 commented on July 29, 2024

Unfortunately with version 1.30.0 of Overseerr the workaround in the documentation for this has broken: https://docs.overseerr.dev/extending-overseerr/reverse-proxy

I had to revert back to 1.29.1 to get it working again.

from overseerr.

markus-li avatar markus-li commented on July 29, 2024

When testing this with subfolders I noticed that the currently suggested sub_filter rules left certain parts broken, such as if you refreshed the page it wouldn't work since the URL wouldn't be correct. It works when clicking around, but a refresh would break. "sw.js" and "offline.html" were also missing.

In case someone else is interested, this is what I came up with for nginx:

location ^~ /pods/direct/overseerr {
    set $app 'pods/direct/overseerr';
    set $app_esc 'pods\/direct\/overseerr';

    # Remove /pods/direct/overseerr path to pass to the app
    rewrite ^/pods/direct/overseerr/?(.*)$ /$1 break;
    proxy_pass http://127.0.0.1:5055; # NO TRAILING SLASH

    # 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 *;
    
    # HREF
    sub_filter 'href="/"' 'href="/$app/"';
    sub_filter 'href="/login"' 'href="/$app/login"';
    sub_filter 'href:"/"' 'href:"/$app/"'; 

    ## Capture some things which shouldn't change
    sub_filter '.id,"/' '.id,"/';
    sub_filter '"/settings/main' '"/settings/main';
    sub_filter '"/settings/password' '"/settings/password';
    sub_filter '"/settings/permissions' '"/settings/permissions';
    sub_filter '"/settings/notifications' '"/settings/notifications';
    
    ## Now the remaining settings paths are ok to change
    sub_filter '"/settings' '"/$app/settings';
    
    ## Default filters:
    sub_filter '\/_next' '\/$app_esc\/_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/';
    
    ## Route-specific filters:
    sub_filter '"/sw.js"' '"/$app/sw.js"';
    sub_filter '"/offline.html' '"/$app/offline.html';
    sub_filter '"/android-' '"/$app/android-';
    sub_filter '"/apple-' '"/$app/apple-';
    sub_filter '"/favicon' '"/$app/favicon';
    sub_filter '"/logo_' '"/$app/logo_';
    sub_filter '"/profile' '"/$app/profile';
    sub_filter '"/users' '"/$app/users';
    sub_filter '"/movie' '"/$app/movie';
    sub_filter '"/tv' '"/$app/tv';
    sub_filter '"/person' '"/$app/person';
    sub_filter '"/collection' '"/$app/collection';
    sub_filter '"/discover' '"/$app/discover';
    sub_filter '"/requests' '"/$app/requests';
    sub_filter '"/issues' '"/$app/issues';
    sub_filter '"/site.webmanifest' '"./site.webmanifest';
    # Setting settings paths so that they don't match the generic replace
    sub_filter 'route:"/settings/main' 'route:"/settings/main';
    sub_filter 'regex:/^\/settings\/main' 'regex:/^\/settings\/main';
    sub_filter 'route:"/settings/password' 'route:"/settings/password';
    sub_filter 'regex:/^\/settings\/password' 'regex:/^\/settings\/password';
    sub_filter 'route:"/settings/permissions' 'route:"/settings/permissions';
    sub_filter 'regex:/^\/settings\/permissions' 'regex:/^\/settings\/permissions';
    sub_filter 'route:"/settings/notifications' 'route:"/settings/notifications';
    sub_filter 'regex:/^\/settings\/notifications' 'regex:/^\/settings\/notifications';
    # Generic route and regex replace
    sub_filter 'route:"/' 'route:"/$app/';
    sub_filter 'regex:/^\/' 'regex:/^\/$app_esc\/';
    sub_filter 'regex:/\/' 'regex:/\/$app_esc\/';
}

from overseerr.

SteffanCline avatar SteffanCline commented on July 29, 2024

from overseerr.

SteffanCline avatar SteffanCline commented on July 29, 2024

from overseerr.

stale avatar stale commented on July 29, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from overseerr.

dwk001 avatar dwk001 commented on July 29, 2024

I saw this was marked stale, so I am commenting to keep it alive. I don't want this closed until it can somehow be implemented. I would happily pay $50 towards dev work of this feature.

from overseerr.

triesmon avatar triesmon commented on July 29, 2024

I'd also like to see this. Would prefer to use a subpath for security reasons and the filter workaround doesn't meet security or ease of maintenance requirements. Changing the subpath should be a fairly easy process with modern programs.

from overseerr.

johnistheman avatar johnistheman commented on July 29, 2024

I added this line to enable the new image caching feature:

sub_filter '/imageproxy/' '/$app/imageproxy/';

But something isn't working quite right still. Maybe there is something else needed?

On the first page load of a movie detail page, the URI for the image will be for example:

https://domain.com/imageproxy/t/p/w600_and_h900_bestv2/blah.jpg

This doesn't load.
I reload the page (doing nothing else) and now the URI for the is:
https://domain.com/overseerr/imageproxy/t/p/w600_and_h900_bestv2/blah.jpg

This image does load.
Reloading the page the image keeps working.
If I go back to Discover, then click in to the movie again, the image isn't loading and reloading the page resolves it again.

from overseerr.

zachi40 avatar zachi40 commented on July 29, 2024

I added this line to enable the new image caching feature:

sub_filter '/imageproxy/' '/$app/imageproxy/';

But something isn't working quite right still. Maybe there is something else needed?

On the first page load of a movie detail page, the URI for the image will be for example:

https://domain.com/imageproxy/t/p/w600_and_h900_bestv2/blah.jpg

This doesn't load. I reload the page (doing nothing else) and now the URI for the is: https://domain.com/overseerr/imageproxy/t/p/w600_and_h900_bestv2/blah.jpg

This image does load. Reloading the page the image keeps working. If I go back to Discover, then click in to the movie again, the image isn't loading and reloading the page resolves it again.

I added this line to enable the new image caching feature:

sub_filter '/imageproxy/' '/$app/imageproxy/';

But something isn't working quite right still. Maybe there is something else needed?

On the first page load of a movie detail page, the URI for the image will be for example:

https://domain.com/imageproxy/t/p/w600_and_h900_bestv2/blah.jpg

This doesn't load. I reload the page (doing nothing else) and now the URI for the is: https://domain.com/overseerr/imageproxy/t/p/w600_and_h900_bestv2/blah.jpg

This image does load. Reloading the page the image keeps working. If I go back to Discover, then click in to the movie again, the image isn't loading and reloading the page resolves it again.

You can try it like this
sub_filter '/imageproxy' '/$app/imageproxy';
it works for me

from overseerr.

qriff avatar qriff commented on July 29, 2024

Since there seems to exist mainly misunderstanding of what the issue with base URLs are, especially how the fixes for subdomains and matching paths do not apply for path rewriting (you just can't, especially without insane overhead, imagine subdomains working being more of a fluke than actual functionality).

Here's an apt writing about the subject:

https://caddy.community/t/the-subfolder-problem-or-why-cant-i-reverse-proxy-my-app-into-a-subfolder/8575

Long story short, with all URI factors in play (actual compatibility and standard implementation), implement "URL Base" support or watch the community forced to transition elsewhere.

from overseerr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.