Skip to content
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

qBittorent UI returns 401 (blank page) when accessed through Kubernetes proxy #8095

Closed
zeppelinux opened this issue Dec 22, 2017 · 10 comments
Closed
Labels
WebUI WebUI-related issues/changes

Comments

@zeppelinux
Copy link

qBittorrent version and Operating System
4.0.3 (latest), Docker 17.03.2-ce, Kubernetes 1.8

What is the problem
qBittorrent responds with 401 on any http GET request

What is the expected behavior
login page is returned for /

Steps to reproduce
deploy qBittorrent in a Pod and expose it as a Service using nodePort type.

Extra info(if any)
When accessed using clusterIP it works as expected, the problem is with the kube-proxy only.

The last version that works with kube-proxy seems to be 3.3.1

@sledgehammer999 sledgehammer999 added the WebUI WebUI-related issues/changes label Dec 22, 2017
@sledgehammer999
Copy link
Member

I don't have any knowledge of what Kubernetes is and how kube-proxy, pod and nodePort work.
Can you explain more? Especially how the connection is supposed to happen between server(qbittorrent) and client(browser).
And maybe @Chocobo1 wants to help here.

@zeppelinux
Copy link
Author

@sledgehammer999 Kubernetes (K8's) creates abstraction on top of Docker (or other container runtime).
When qBittirrent contsiner image is deployed by K8's it receives the internal (cluster) IP, this is the Pod IP (and qBittorrent is running in the Pod). This IP is accessible only from hosts/other pods connected by the same network overlay (flannel for example). It works, i.e. I can access the qBittirrent pod by curl executed on the host that knows what to do with the provided IP. Pod IP's are mortal i.e. each time it restarts it gets new IP.
In order to expose the Pod (with running qBittorent inside) there are in general two ways - create Service or Ingres objects. There are some heavy limitations with Services because it's Level 4 proxy. For example, Service supports session affinity based on client IP only, i.e. if requests are coming through load balancer or gateway - they all will have the same IP.

Service is implemented as a set of IP table rules that know how to take traffic from the host:nodePort and route it to the Pod. Kube proxy is a daemon that maintains the IP tables rules on each node (host).
Here is the connection between client (curl or browser) and qBittirent process:

curl node:nodePort -> Node IP tables -> Pod:8080

@zeppelinux
Copy link
Author

Correction:

curl node:nodePort -> Node (IP tables) -> podIP:podPort ->qBittorrent:8080

Hope it makes sense.

@zeppelinux
Copy link
Author

I deployed Nginx ingress controller (which is basically Nginx server) and still fails with 401.

Looks like it's related to this #6962

I applied all the headers as described here https://github.com/qbittorrent/qBittorrent/wiki/NGINX-Reverse-Proxy-for-Web-UI - still no luck.

Can anybody share working Nginx configuration (when Nginx and qBittorrent are deployed on different hosts)?

@zeppelinux
Copy link
Author

Found another related issue (and it still open) #7028

@zeppelinux
Copy link
Author

zeppelinux commented Dec 28, 2017

Used this #5693 to figure it out, for anybody else having the same issue the kubernetes ingress yaml should look like this:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/configuration-snippet: |
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  name: qbittorrent-ingress
spec:
  rules:
  - host: <your-domain-name>
    http:
      paths:
      - backend:
          serviceName: qbittorent-service #or whatever service name you created
          servicePort: 8080

@Fastjur
Copy link

Fastjur commented Jan 5, 2018

@zeppelinux I am the original reporter of the issue/feature request #5693

Just to confirm, did you get it to work with a work around or has the base URL been implemented?

@kurosh
Copy link

kurosh commented Jan 26, 2018

Another +1 for this, not working for me behind Nginx. Login screen appears (without any images strangely) then when I submit the password appears in the URL and goes to blank screen :|

@4ft35t
Copy link

4ft35t commented Mar 14, 2019

I had the same issue with run qBittorrent v4.1.5 Web UI on docker. And #9333 not works for me.
Finally solved by change qBittorrent.conf
from
WebUI\HostHeaderValidation=true
to
WebUI\HostHeaderValidation=false

@dm9tr0
Copy link

dm9tr0 commented Apr 16, 2020

I use docker image
linuxserver/qbittorrent:latest
And solution
WebUI\HostHeaderValidation=false
Works for me, but with this setting Web UI will be accessible to anyone in the Internet without credentials.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
WebUI WebUI-related issues/changes
Projects
None yet
Development

No branches or pull requests

6 participants