Skip to content

fix: support IP address as QBITTORRENT_HOST#86

Merged
monstermuffin merged 1 commit intomainfrom
dev
Mar 24, 2026
Merged

fix: support IP address as QBITTORRENT_HOST#86
monstermuffin merged 1 commit intomainfrom
dev

Conversation

@monstermuffin
Copy link
Copy Markdown
Owner

When QBITTORRENT_HOST is set to a raw IP address, aiohttp drops the
session cookie after login, causing all subsequent requests to return
403.

The fix detects whether QBITTORRENT_HOST is an IP address at startup
and passes CookieJar(unsafe=True) to the ClientSession in that case.

Tested locally in Docker against linuxserver/qbittorrent:latest.

Hostname (gluetun) - no regression:
unsafe False
Successfully logged in to qBittorrent
current_port 6881

IP - before fix:
login False 200 Ok.
cookies False
prefs False 403 Forbidden

IP - after fix:
unsafe True
Successfully logged in to qBittorrent
current_port 6881

aiohttp rejects session cookies by default when the host is an IP
literal. Detect whether QBITTORRENT_HOST is an IP address at startup
and, if so, create the ClientSession with CookieJar(unsafe=True).
Hostname-based connections are unaffected.

Made-with: Cursor
@monstermuffin monstermuffin merged commit 4f948b9 into main Mar 24, 2026
3 checks passed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

🎉 This PR is included in version 2.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant