-
Notifications
You must be signed in to change notification settings - Fork 67
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
Incorrect URL created when qBittorrent is behind a reverse proxy causing 404 error #37
Comments
can you please provide one of the working it looks like you're prefixing the Web API paths with |
Yes my reverse proxy is trimming the prefixes. qBittorrent currently doesn't support base urls, so I have to trim it to make it available through the reverse proxy. There is an issue open for it on qBittorrent: qbittorrent/qBittorrent#5693 It has been open for quite some time though, so I don't know when that feature will be added. It's possible that this could be considered an upstream issue. Anyways here is the command: curl http://192.168.1.69/qBittorrent/api/v2/app/version --cookie "[BROWSER COOKIE]" I copied the cookie from my browser after logging in through the Web UI. I didn't want to include it in case it contained any sensitive information, but the output does work. % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6 100 6 0 0 6000 0 --:--:-- --:--:-- --:--:-- 6000
v4.3.1 |
hmm....even if they supported a base url, i still think this client would be broken....since it'll always send the default paths....unless qbittorrent just accepted either i guess. in theory, it wouldn't be too hard to prefix the API path with any user provided base path. just a little concerned that could be a breaking change to some users if they are randomly including a path in their instantiations right now....seems pretty unlikely though. i can at least mock something up in the next few days. thanks for letting me know. |
I guess this is probably better addressed upstream by qBittorrent devs. I can always just use Docker DNS to connect to the API endpoints directly instead of using a reverse proxy. Thanks for looking at it so quickly though! |
- Allows users to leverage this client when qBittorrent is configured behind a reverse proxy. - For instance, if the Web API is being exposed at "http://localhost/qbt/", then users can instantiate via Client(host='localhost/qbt') and all API endpoint paths will be prefixed with "/qbt". - Additionally, the scheme (i.e. http or https) from the user will now be respected as the first choice for which scheme is used to communicate with qBittorrent. - However, users still don't need to even specify a scheme; it'll be automatically determined on the first connection to qBittorrent. - Neither of these should be breaking changes, but if you're instantiating with an incorrect scheme or an irrelevant path, you may need to prevent doing that now.
@zachoooo, I released v2020.12.14. It should now support your instantiation below and make calls using qbt_client = qbittorrentapi.Client(host='http://[HOST]/qBittorrent/', username='[USERNAME]', password='[PASSWORD]') |
I have my qBittorrent instance on a docker network along with a reverse proxy and the Web UI is available at http://[HOST]/qBittorrent/. The API is available and works correctly, when using curl or my browser. qbittorrent-api seems to ignore the base url and so I've been getting 404s when trying to use the API. Here is the example code:
The text was updated successfully, but these errors were encountered: