-
-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Need baseURL for reverse proxy support #97
Comments
Looks like there was a failed attempt to implement in sct/overseerr#2383. |
I wouldn't say failed really. It's just more hacky than we'd like since Next.js doesn't allow for changing the base URL after build time. But the PR worked just fine for as long as I was testing it. There's a preview image for it if you guys wanna try it out (one image was accidentally made, so it's either this one or this one) |
Hm someone on discord said they got baseurl working with swag |
@ddimick I have the detailed instructions on how to get it to work as well if needed |
@Fallenbagel please post instructions for the baseurl mod |
@Fallenbagel your config was working great until recently. Login screen just loops now. |
Since Overseerr 1.30.0 which is 1.2.0 of jellyseerr, the config is now different. |
Why am I the last person still using Apache? Haha. |
You are not. I am stuck too, looking for an Apache solution |
In my limited knowledge of apache, isn't nginx and apache very similar in its configuration? 🤔 |
I hope to see this feature in future versions. There's no way to set a baseurl inside jellyseerr. Ombi has this but not jellyseerr |
I would also love to see this much needed feature added :) |
Why cant the base URL just be implied from the application URL setting? |
I'd be interested in this! I don't know TS/React enough to make the change myself |
The current implementation disallows urls without a |
I have made a workaround for Nginx thanks to the help of what has already been provided and some minor tweaks of my own. Complete Nginx configBelow is what you would put within your Nginx config, it contains the Javascript that is to be injected into the clients webpage. location ^~ /jellyseerr {
set $app 'jellyseerr';
# Remove /overseerr path to pass to the app
rewrite ^/jellyseerr/?(.*)$ /$1 break;
proxy_pass http://172.17.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 *;
#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';
} Formatted Javascript:Below is the formatted javascript for if you want to read how it works or modify it, you do not need to do anything with this if you have copied the config above. //https://stackoverflow.com/questions/6390341/how-to-detect-if-url-has-changed-after-hash-in-javascript
(() => {
let APP_PATH = "jellyseerr";
let oldPushState = history.pushState;
history.pushState = function pushState() {
//Check if we need to fix the path (if it dosent start with /jellyseerr then we need to fix it)
if (arguments[2] && !arguments[2].startsWith("/" + APP_PATH))
arguments[2] = "/" + APP_PATH + arguments[2];
let ret = oldPushState.apply(this, arguments);
window.dispatchEvent(new Event('pushstate'));
return ret;
};
let oldReplaceState = history.replaceState;
history.replaceState = function replaceState() {
//Check if we need to fix the path (if it dosent start with /jellyseerr then we need to fix it)
if (arguments[2] && !arguments[2].startsWith("/" + APP_PATH))
arguments[2] = "/" + APP_PATH + arguments[2];
let ret = oldReplaceState.apply(this, arguments);
window.dispatchEvent(new Event('replacestate'));
return ret;
};
window.addEventListener('popstate', () => {
console.log('popstate');
});
})(); |
I think proper support should simply be implemented. For those that host multiple services on a single domain needing different sub-paths this won't work (domain.com/radarr, domain.com/sonarr, etc.). The ability to override the useragent (if users request) would be nice too (Jellyfin still thinks it is Overseerr). |
Although it is great (not to mention very helpful, thank you) to see a workaround with nginx via realtime rewrites, there are many other popular proxies. Apache, Caddy, Traefik, Cloudflare, etc. People who use OAuth may also find their configurations more complicated than would be otherwise necessary. |
The useragent is fixed in develop.
|
Well that bites. x_x; |
Doesn't work for me, 404 error page not found. I installed it via Docker |
@caio1007 the workaround is different now. You can find the latest updated one in the pinned thread on our discord. |
How about being able to change the links generated by the software? I can have a proxy fetch / and show others /Jellyseerr, can I simply get the base href altered by a variable? That'd solve it for me. It should be usable for everyone. Just have your proxy serve to / from a particular location and simply have Jellyseerr use base href in the template. That way no base url would be entirely necessary, a proxy could rewrite to / and Jellyseerr could set one html tag which can affect all relative links on a page. https://www.w3schools.com/tags/tag_base.asp The links are already relative, for what I can see. Just literally add a base tag and allow us to set the href. :) |
Damn. I didn't expect it to be this hard. Code can be a bitch sometimes |
It's not hard at all, I already mentioned how to address it. Reverse-proxies can be setup to pull directly from / and you can simply set a base href with links not beginning with |
And what if my host does not allow that? |
Define |
Apologies, I am awful at explaining stuff. I use https://ultra.cc to host a Jellyfin server, I believe me trying to setup what you're describing would be against their TOS |
??? What does your host have to do with anything? This thread is about Jellyseerr and using a subpath instead of accessing via 80, 443, or some other port while using a reverse-proxy to provide a clean subpath instead. |
Ultra.cc manages jellyseerr and creates the sub path by itself |
...So what are you here for then? |
They manage the web proxy not me, so the solution is impossible to implement for me until someone fixes in in the actual code of jellyseerr #669 was my first post, but then I was redirected to here since im blind and didn't see this one |
Edit: Removed post after seeing #669 which was not at all obvious or known. There is nothing you can do, but my solution would fix that. All links need to be updated to remove |
I will simply show you this doc, which shows that it will come pre-installed under a subpath https://docs.ultra.cc/books/jellyseerr/page/jellyseerr Edit: ah, It seems they also have their own janky fix: |
That's not a subpath. That's a subdomin. |
Imo I don't think using base href would be good for a nextjs app. I have looked into a way to make subpath possible and I have found a solution. It's less hacky than the method that was tried before. Basically using a dynamic segment that houses all the pages and using a middleware that looks for a subpath using the |
I'm not sure if you're talking about the host I'm using, but if so, it is a subpath. a subdomain would be "jellyseerr.example.com" whereas a subpath is "example.com/jellyseerr" The host I use uses this format for domains "username.servername.usbx.me/appname" Which is a subpath, not a subdomain. Is there a technical explanation on why it's so hard to set the baseURI. Can there be a settings option for it that applies after restart? Pretty much every other application I use does it just fine. Sonarr, Radarr, qBittorrent, Jellyfin, Autobrr, file browser, etc. |
In other words routing processing. The expressed lack of possibility of that is what led me to base href. Base href would be much easier and much more compatible across any configurations, two-cents. Base href would work under all scenarios, especially since it too can be relative. Eg "/jellyseerr" would would make any/all links relative to jellyseerr under any domain or subdomain or port configuration. Base href is the way these should be addressed, but whatever solution is accepted is fine with me.
...No that's a subdomain and a subpath. ... If you bothered to read the thread you'd have already seen the technical explanation. |
I added a part that monitors the DOM to modify the Nginx sub filter:
Formatted script:(() => {
const APP_PATH = "/jellyseerr";
const oldPushState = history.pushState;
history.pushState = function pushState() {
//Check if we need to fix the path (if it dosent start with /jellyseerr then we need to fix it)
if (arguments[2] && !arguments[2].startsWith(APP_PATH))
arguments[2] = APP_PATH + arguments[2];
const ret = oldPushState.apply(this, arguments);
window.dispatchEvent(new Event("pushstate"));
return ret;
};
const oldReplaceState = history.replaceState;
history.replaceState = function replaceState() {
//Check if we need to fix the path (if it dosent start with /jellyseerr then we need to fix it)
if (arguments[2] && !arguments[2].startsWith(APP_PATH))
arguments[2] = APP_PATH + arguments[2];
const ret = oldReplaceState.apply(this, arguments);
window.dispatchEvent(new Event("replacestate"));
return ret;
};
function addPrefixToLinks() {
document.querySelectorAll("a[href]").forEach((link) => {
const href = link.getAttribute("href");
if (href.startsWith("/") && !href.startsWith(APP_PATH)) {
link.setAttribute("href", APP_PATH + href);
}
});
}
document.addEventListener("DOMContentLoaded", function () {
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.addedNodes.length) {
addPrefixToLinks();
}
});
});
observer.observe(document.body, {
childList: true,
subtree: true,
});
addPrefixToLinks();
});
})(); |
I did a binary patch of |
I was setting up
This is ofcourse running in docker and from my compose file EDIT: added the top 2 lines in the example |
Any final solutions for this issue ? |
We don't support subfolders. Discord has the working workaround for it |
@Fallenbagel I managed to succeed in doing it using this guide: |
Description
We need a baseURL setting (like Radarr and Sonarr have).
Desired Behavior
Allow Jellyseerr to run on
https://my.url.com/jellyseerr/
.Additional Context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: