j4ym0 / pia-qbittorrent-docker

Private internet access & qBittorrent Docker
https://hub.docker.com/r/j4ym0/pia-qbittorrent/
MIT License
90 stars 24 forks source link

"Unauthorized", I Can not Aceess Qbittorrent WebUI from Domain #26

Closed tusx closed 3 weeks ago

tusx commented 4 weeks ago

Hello,

First of all, thanks for making this Project 🎉

I personally use this on a server and wish to access it by a domain name + nginx proxy manager due to the above scheme, I'm unable to access the Webui. I get "unauthorized" when i try to access the webui through the domain.

This seems to be a know issue and has possible fixes

setting WebUI\HostHeaderValidation=false works for some, but personally in past setting WebUI\CSRFProtection=false has worked when using Nginx Proxy Manager

i would really appreciate and maybe other's too if these options were change in qBittorrent.conf

if Directly implementing these changes in the config file is not ok, maybe adding an option with environment variable be a better way for all.

From my understanding of this bug/issue only occurs when a reverse proxy is involved or so i think.

Again, much appreciate the effort that have been put into this project.

j4ym0 commented 4 weeks ago

@tusx Using a domain name should work fine as long as you use the same port as the web port setup on the docker.

I can look at adding this in as a environment variable.

Have you tried playing with the reverse proxy support and trusted proxy's in the options in qbittorrent, does this affect the needs for these settings?

tusx commented 4 weeks ago

@j4ym0 i have not checked the settings you mentioned in the options of qbittorrent.

What i had tried was setting the Host header in the NPM (Nginx proxy manager) to localhost or 0.0.0.0 Which did not work.

Using Docker exec i edited the qbittorrent.conf and set the WebUI\HostHeaderValidation=false and restarted the container which didn't work.

I then edited the WebUI\CSRFProtection=false then restarted the container and i was abale to access the webui

Not sure if you are mentioning this proxy settings in QBittorrent or other but i believe these settings are for torrenting itself and are not related to webui IMG_20241028_192439

If there is a possibility of adding options for these values with environment variables that would be useful and won't interrupt previous installations aswell

Thanks for helping out

tusx commented 4 weeks ago

Forgot to add, in my setup container is running webui on port 8888 but im accessing it through ex: qbit.domain.com so port 80 i guess. This could be the issue i guess

j4ym0 commented 3 weeks ago

in the web ui there is reverse proxy support, i was wondering if enabling that would allow access without disabling HostHeaderValidation and CSRFProtection image

The reason you’re getting an "Unauthorized" error is because you’re accessing the Web UI on a different port than the one configured. Disabling the two settings will bypass the security checks.

tusx commented 3 weeks ago

Never knew there was this setting and i have been through that section thousands of times kotoura_san-07-haruka-surprised-cute-adorable-36777899

Currently away from my pc. I will update once i test this option. Thanks for pointing it out.

j4ym0 commented 3 weeks ago

add -e HOSTHEADERVALIDATION=false -e CSRFPROTECTION=false update pushed to docker hub

tusx commented 3 weeks ago

@j4ym0 thanks for making this, much appreciated.