-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Support configuring WebUI URL base path #21471
base: master
Are you sure you want to change the base?
Conversation
bf342fb
to
b07bc4f
Compare
From what I can tell from the code, using your current examples, setting "URL base path" to You probably want to add some sanity checks if you really want to push this through, but unless a proxy doesn't support rewrites this might be unnecessary (see my comment here). If you do push forward, you may want to use the |
Thanks for the feedback. There's already a sanity check to ensure the path ends with a trailing slash. Good call on the leading slash - I'll add a check for that. The reason I'm not using the |
3a65cad
to
0c1f2a8
Compare
0c1f2a8
to
af1bfbe
Compare
71cea6b
to
3e6db0d
Compare
@qbittorrent/bug-handlers Can someone please review this? It has been open for over a month. There are merge conflicts but the general approach will remain the same. |
There is one concern from me but I'm not sure it is fully related. I haven't evaluated thoroughly. Also, another related question: is nginx able to inject base url in the requests on its own (without any help from qbt side)? Is it problematic to do so? |
I think it's a valid concern, however users seem to really want this feature. I think the best option would be to allow users to configure this but also make it clear (maybe in the wiki) that this approach is suboptimal and that using a unique (sub)domain is preferable.
I'm not certain. In #5693 it seems that some users are using nginx's |
The cache now persists more than just translations.
This provides the underlying support for having a configurable base path. Future commit(s) will expose this functionality to users.
This applies to all scripts, css, images, and WebAPI requests.
3e6db0d
to
c68971a
Compare
From my experience with reverse proxies, I would prefer that if the reverse proxy is able to support the feature by itself then qbt shouldn't bother with it. This is based on the assumption that the reverse proxy won't have to resort to quirky workarounds. The opening post in #5693 provided an example of nginx config and it looks fine to me. Note that our wiki page for nginx also mentioned such usage. |
👍 |
If this qBittorrent feature's goal is to support setting a custom base path, it seems to me that qBittorrent should be responsible for setting that base path. We shouldn't rely on a feature that may be available in a subset of reverse proxies. |
"Setting a custom base path" is clearly not a goal in itself. Its purpose is only to circumvent the problem of access via reverse proxy (using some kind of configurations). (I don't remember getting an answer to my previously asked question.) Can't the problem be solved by using relative paths? |
The goal of this change is to be able to host qBittorrent at some path other than the root (
It can't be solved solely with relative paths, otherwise there would be no need for this PR. I also personally believe absolute paths are prefereable to relative paths when it's possible to use absolute paths. |
Do you have anything substantial to back up these words? Some specific case among those found in the qBittorrent WebUI sources, in which it is impossible to use a relative path. |
The issue this fixes has an entire thread discussing why this doesn't work. If this could be solved solely with relatively paths, there would be no need for this PR. What's your reservation with switching to absolute paths? |
So, can't you summarize them and provide a brief description of the essence of the problem?
For me it looks like a workaround rather than a solution. I really don't understand why it can't work, provided that all resources correctly refer to each other by their relative paths. |
There is a perfectly readable summary in the first comment of the GitHub issue that this PR resolves. I'll paste it here for people that can't find the link... It would be really useful if there is an option to specify the base URL path for use in reverse proxies. This way one can circumvent having to type the port number into the URL. For instance, when the qBittorent web UI is running on port 8080, and the base url is set to
Thus allowing one to go |
@CodeAbuser |
I suspect the problem would be solely at web api paths instead of html/js. But again, if proxies are able to handle it, I don't see why qbt should care about it. Furthermore, I don't see why qbt server would need different base path when there were no proxy involved. (AFAIK a proxy is required in order to run different qbt instances on different base paths) |
This does not change the essence of the question. If all of them are correctly referenced in the WebAPI code by their relative paths what could be the problem? P.S. I've just run nginx using config provided in qBittorrent Wiki and I found no problems (at least by testing it quickly). |
According to this comment, the Nginx config in the wiki is incomplete. Another relevant comment: #5693 (comment) |
This PR adds support for configuring the URL base path used to access the WebUI. This makes it easier to use qBittorrent behind a reverse proxy with a custom path (e.g.
https://example.com/qbit/
).The WebUI previously relied heavily on relative paths. For example, api requests were made to
api/v2/...
and scripts were loaded fromscripts/lib/...
(note the lack of a leading/
). Now, the WebUI exclusively makes use of absolute paths, defaulting to a base path of/
. These means that, by default, these resources will be loaded from/api/v2/...
and/scripts/lib...
, respectively. An empty base path can no longer be set - if attempting to do so, it will use/
.Closes #5693.