BiglySoftware / BiglyBT

Feature-filled Bittorrent client based on the Azureus open source project
https://www.biglybt.com
GNU General Public License v2.0
1.56k stars 153 forks source link

Authentication not working with reverse proxy of web interface #3390

Open alex9434 opened 1 week ago

alex9434 commented 1 week ago

OS: Debian Bookworm BiglyBT: 3.6.0.0

I have activated user and password for the web interface. I can log-in to the webinterfase using the ip/hostname from the local lan, e.g. http://user:password@hostname:9091.

However, this does not work over the internet behind a nginx reverse proxy. Behind the proxy, the authentication is not successful. This is surprising, because the IDENTICAL nginx reverse proxy configuration works for the web interface of Transmission, which was used for biglybt.

Here is my nginx configuration:

server {
    listen 80;
    listen [::]:80;
    server_name *deleted*;

    location / {
        proxy_pass http://127.0.0.1:9091;
        proxy_pass_header X-Transmission-Session-Id;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

BiglyBT alsways shows the authentication prompt in the browser. Even after providing correct username and password, the authentication is never successful. The authentication prompt is displayed again. Cancelling the prompt gives the error message "Access Denied".

parg commented 1 week ago

Does "View->Logs Views->BiglyBT Web Remote" show anything?

parg commented 1 week ago

Hmm, there's some code that treats the existance of an "X-Real-IP" header as "someone messing about" and fails the request

parg commented 1 week ago

I went ahead and added a new option the the latest beta (B45) so you can specify that the web remote is behind a reverse proxy. If you set that then it should pay attention to X-Real-IP

DamianoP commented 6 days ago

it seems to me that the same thing happens with Android. In my case I have a smartphone that I use as a torrent server but it can only be accessed from LAN, if I try from VPN or a remote server the authentication doesn't work properly