feat: add captive portal (zero-trust proxy) authentication support#695
feat: add captive portal (zero-trust proxy) authentication support#695jerzykrlk wants to merge 1 commit into
Conversation
Detect when the server is behind a zero-trust proxy (Cloudflare Access, Authelia, etc.) and present an embedded browser for authentication. Cookies are persisted and forwarded to all request paths including audio streaming. Session is cleared on explicit logout but preserved on token expiry for seamless re-authentication.
|
First of all thank you for providing PRs. |
|
Hello @BLeeEZ , thanks for the reply! I didn't think of that before, apologies. I'll find something suitable and get back to you. |
|
@jerzykrlk I'd love to see this PR merged, so if there's anything I can do to help with testing (eg. I could set up a sample Navidrome instance behind a CF Zero Trust tunnel for @BLeeEZ) - please let me know! |
|
Here's a sample docker compose stack. services:
cloudflared:
image: cloudflare/cloudflared:latest
container_name: cloudflared
restart: unless-stopped
environment:
- TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}
command: tunnel --no-autoupdate run
networks:
- cloudflare
navidrome:
image: deluan/navidrome:latest
container_name: navidrome
user: 1000:1000
ports:
- "4533:4533"
environment:
- PUID=1000
- PGID=1000
restart: unless-stopped
volumes:
# - ./volumes/navidrome/data:/data # optionally set your data dir for a persistent container
# - /mnt/hdd/music:/music:ro # optionally mount your music library
networks:
- cloudflare
networks:
cloudflare:
driver: bridgeThen in Cloudflare:
Now you should be able to navigate to subdomain.domain.com that you entered above in a browser, and it will prompt for your cloudflare username and password, then it should navigate you to the Navidrome web ui. |
Hello all,
This MR detects when the server is behind a zero-trust proxy (Cloudflare Access, Authelia, etc.) and present an embedded browser for authentication.
Cookies are persisted and forwarded to all request paths including audio streaming. Session is cleared on explicit logout but preserved on token expiry for seamless re-authentication.
It's slightly related to #694 - I just thought it would be useful for those who don't want to generate a private key.
Thanks!