Tdarr
Tdarr copied to clipboard
Unable to use Nginx with Tdarr V2 on Windows
Describe the bug
With V2, when you set a base URL (e.g. "/base") in the web-ui, it does not change the ROOT_URL, nor does it update API calls.
When running NGINX, this means that instead of API calls in TDARR pointing to
http://localhost/tdarr/api/v2
, it instead points to http://localhost/api/v2
Because I'm also using Organizr, this API point is already in use by the Organizr V2 api (plus, Tdarr api folder isn't in that directory)
In addition, the landing page appears when you go to http://localhost:8265
, but that should not work as only the base URL should work, in this case http://localhost:8265/base
.
Also, applying suggested environment variables in CMD does not work:
To Reproduce Run Tdarr_Server, Tdarr_Node, and Tdarr_Webui and attempt to get it working behind Nginx proxy. Worked fine on the old TDARR, as I was able to include BASE and ROOT_URL variables when launching it from CMD.
Expected behavior Setting the Base URL in the web-ui, should fully set the URL base, including API calls and the landing page. I would also expect the settings to save to the config file, making them more accessible for editing.
Desktop (please complete the following information):
- OS: Windows 10
- Browser: Chrome
- Version: V2 preview
I'm flat out unable to set the baseURL in the Options tab. When I change it (there's no apply button, so I think it saves..?) nginx can't connect, and the parameter is cleared after I reboot the container which makes me think it's not actually setting (or clearing on reboot). I'm using unRAID's docker setup with Beta 1.3003 tdarr_aio
I have the same issue as @Flippage, but my tdarr is running in docker and my nginx is running on ubuntu.
@joshbgosh10592 you seem to have a different issue, as this is about tdarr v2
I have not really used nginx so will need to see if I can get it running on Windows this week.
+1 Same issue both on Docker and running without Docker.
Can confirm on a linux system. I don't think it has anything to do with the operating system. Setting the following environment variables for the docker container does not seem to change the base path:
ROOT_URL: "http://localhost/tdarr"
BASE: "/tdarr"
I think you’re right. If I set the base path to say /tdarr and visit localhost:8265/tdarr/tdarr I get an error and if i just go to /tdarr it just doesn't load properly, but then i can navigate to /tdarr/tdarr fine from there. it's really weird
This issue continues to exist in 2.00.09. Setting the baseurl only appears to impact loading specific pages, but does not update the landing page and, more importantly, does not update the API path, breaking the ability to reverse proxy effectively.
My "solution" (which isn't really a solution) was to put tdarr on its own subdomain (so now it's tdarr.example.com instead of example.com/tdarr
Any updates on this one? Still present in 2.00.10
Hi all, sorry for the delay. I believe this is now fixed in the acceptance 2.00.12 containers so if one of you can quickly run one of the following commands and verify it's working as you'd expect. All you need to do now is set the basePath env/config variable on the server, you'll then see in the log on startup the webui address:
Tdarr_WebUI running at http://localhost:8265/examplePath/test
Windows CMD:
docker run -ti ^
-e "serverIP=0.0.0.0" ^
-e "webUIPort=8265" ^
-e "serverPort=8266" ^
-e "basePath=/examplePath/test" ^
--network="bridge" ^
-p 8265:8265 ^
-p 8266:8266 ^
-e PUID=1000 ^
-e PGID=1000 ^
--log-opt max-size=10m ^
--log-opt max-file=5 ^
haveagitgat/tdarr_acc
Windows Powershell
docker run -ti `
-e "serverIP=0.0.0.0" `
-e "webUIPort=8265" `
-e "serverPort=8266" `
-e "basePath=/examplePath/test" `
--network="bridge" `
-p 8265:8265 `
-p 8266:8266 `
-e PUID=1000 `
-e PGID=1000 `
--log-opt max-size=10m `
--log-opt max-file=5 `
haveagitgat/tdarr_acc
Posix:
docker run -ti \
-e "serverIP=0.0.0.0" \
-e "webUIPort=8265" \
-e "serverPort=8266" \
-e "basePath=/examplePath/test" \
--network="bridge" \
-p 8265:8265 \
-p 8266:8266 \
-e PUID=1000 \
-e PGID=1000 \
--log-opt max-size=10m \
--log-opt max-file=5 \
haveagitgat/tdarr_acc
I've noticed that if you run it from a git bash terminal on Windows, it for some reason appends C:/Program Files/Git
to the basePath but that's to do with Git bash variables that start with a '/', not Tdarr.
The basePath will show up on the options tab as a non-configurable value:
https://tdarr.io/docs/pre-releases
Thanks
@HaveAGitGat Thanks for all your work on this great software.
This still doesn't seem to be working correctly in 2.00.12.
I have set the basePath to /tdarr but api and socket requests are not honoring that setting.
I get the same result that @danomoseley is getting
@HaveAGitGat same results as @au5ton and @danomoseley on my side - this bug remains unfixed.
I'll take another look at this.
The broken path prefix applies not only to windows btw.
I'm close to get it partially working by using this Nginx configuration.
location ^~ /tdarr {
set $app 'tdarr';
# Remove /tdarr path to pass to the app
rewrite ^/tdarr/?(.*)$ /$1 break;
proxy_pass http://ADDRESS:8265/;
# Redirect location headers
proxy_redirect ^ /$app;
# Sub filters to replace hardcoded paths
proxy_set_header Accept-Encoding "";
sub_filter_once off;
sub_filter_types *;
sub_filter 'href="/"' 'href="/$app"';
sub_filter 'href:"/"' 'href:"/$app"';
sub_filter '/api/' '/$app/api/';
sub_filter '/images/' '/$app/images/';
sub_filter '/socket.io' '/$app/socket.io';
}
The following endpoints are failing to load properly (due to the filters - I'm not sure how to fix this).
https://tdarr.io/api/v2/versions
(Due to /api/ rewrite.)
https://tdarrs.s3.us-west-000.backblazeb2.com/data/images/splash_bg.jpg
(Due to / rewrite/)
/socket.io
(Web Socket connection endpoint.)
If anyone has any suggestions, that would be great!
Is there any news on this? Just about to try and put this behind Organizr.
I've given up and use FileFlows instead.
Yeah sorry didn't get round to fixing this (had a go but ran into some issues as not too familiar with nginx). Yeah think John/Revens over on FileFlows handles it (would ping him but think he's at work now) and there's also Unmanic which I think might do it.
Will have another crack at it later this week or next.
Spoke to Reven as he says FileFlows doesn't officially support this and we were a bit unsure of the use case (instead of e.g. using subdomain or something like that).
Eitherway the issue with Tdarr is a bit of a chicken and egg problem in that the web UI needs to know the baseURL before contacting the server to get the baseURL.
To get around this I've made it so if you end the url in tdarr
then the UI will autodetect you're using a custom url and correct the api and socket.io requests. No variable needs to be set for Tdarr_Server as we'll do it all using nginx.
So, for example, you'd set your nginx config as
location ^~ /home/tdarr {
# remove /home/tdarr from the request
rewrite ^/home/tdarr(/.*)$ $1 break;
proxy_pass http://127.0.0.1:8265/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
So you can sue urls such as:
/hometdarr
/home/tdarr
/tdarr
/test/abc/tdarr
Make sure to add a trailing slash e.g. http://localhost/home/tdarr/
as without it the screen in just blank (not 100% sure why atm)
Can try it using:
https://tdarrs.s3.us-west-000.backblazeb2.com/dev/versions/2.00.20/linux_x64/Tdarr_Server_2023_03_24T19_05_39z.zip
docker pull haveagitgat/tdarr_acc:dev_2.00.20_2023_03_24T19_05_39z
Hope that helps.
I've improved the nginx config so no trailing slash needed (as I previously mentioned), added to the docs here:
https://docs.tdarr.io/docs/installation/extra#using-a-base-path-with-tdarr-webui
So should be able to close this now. Ty.
2.00.20 released
This seems to work for me. Thank you!
Great :)