Trying to get Basic Auth to persist in non-browser apps

1. The problem I’m having:

So I’d like Basic Auth to persist in non-browser apps somehow, possibly need a module recommendation. I host a personal IPTV server for my kids so it’s just perpetual programming that I use caddy’s reverse proxy to access, and Basic Auth so that the server can’t be scrapped by anyone. Unfortunately most IPTV apps do not allow a browser login window to pop up to login, so I have to format the URL as “https://username:password@iptvserver.hopto.org/

The problem with this, is that again, most IPTV apps expect to login ONCE with this username/pass URL, and be allowed access after that. But Caddy expects a login each and every time the app calls back to the server. Most IPTV apps don’t allow the username/pass to be appended to every URL it needs to access, like the individual channel streams, the channel logos, etc.

What ends up happening is that I’m able to access the IPTV m3u playlist with the username/pass URL, but none of the streams or channel logos since the IPTV app subsequently tries to access just “https://iptvserver.hopto.org/iptv/channelLogo.png” instead of
https://username:password@iptvserver.hopto.org/iptv/channelLogo.png” expecting the login to persist after the first login.

Just to be clear: I am NOT looking for help with those apps as they all seem to be designed similarly with similar functionality, I am just looking for how I can get Caddy to function as expected by these IPTV apps. I assume that this will need to be done by cookies somehow, but I would like to be pointed in the right direction if possible.

2. Error messages and/or full log output:

No errors, just a functionality question.

3. Caddy version:

v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

4. How I installed and ran Caddy:

Via download and CMD prompt

a. System environment:

Windows 10

5. Links to relevant resources:

The apps I would like to use this with is TiviMate and Televisio.

I am also aware of this similar topic, however I would like a recommendation for an alternative auth module as I am barely versed in Caddy. Thanks!

You would need a solution that stores a session server-side and uses cookies to persist the session. That’s not something Caddy does out of the box, because that’s a more complex concern.

You can use the forward_auth directive with another auth provider app like Authelia to do this.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.