Skip to content

replace default UA with device's UA#5430

Open
knighthat wants to merge 1 commit intojellyfin:masterfrom
knighthat:master
Open

replace default UA with device's UA#5430
knighthat wants to merge 1 commit intojellyfin:masterfrom
knighthat:master

Conversation

@knighthat
Copy link

Changes

Current implementation uses default user agent from both JellyfinJDK and OkHttp. This inconsistence makes managing multiple devices a pain in the ass. On some stricter networks, presence of "okhttp" or default user agent will instantly get 403.

image

This PR aims to bring device's user agent as the default, so that devices can be easily ID'd on the network

image

Code assistance

No AI model was used to generate code (I don't like them looking at what I'm working on). Though, I did use Gemini to pinpoint the problem. I asked it why I could access Jellyfin on Amazon Silk (FireTV's web browser) but not in the app, coupling with some Nginx configuration on my end, it was able to pinpoint exact problem. I blocked okhttp in UA, removing it did solve the issue, but I didn't want to compromise security for a streaming service.

Issues

None that I can find


If there's another component that also makes network request that isn't "patched", please let me know.

@nielsvanvelzen
Copy link
Member

The source of truth for the user agent used in network requests is in our SDK. If we'd want to expand the usage of that user agent to other network requests (media3/coil) we'd have to expose the user agent string from the SDK or, likely the better solution, set it from the ApiClientFactory directly.
Overriding it from the app is NOT something we're going to do, and we're also not going to put some webview user agent into it.

@knighthat
Copy link
Author

knighthat commented Feb 24, 2026

The source of truth for the user agent used in network requests is in our SDK

That's part of the problem too. Because of that, requests make by the sdk present a generic UA, while requests make by coil3 present a different one. Coil3 uses its default UA because the request never goes through sdk

image image

If we'd want to expand the usage of that user agent to other network requests (media3/coil) we'd have to expose the user agent string from the SDK

Then it doesn't solve the problem I'm trying to fix. If 3 TVs connect to the same server, they all present the same UA.

we're also not going to put some webview user agent into it.

It could be anything, a custom string set by user is also ok too. I chose webview UA because it was easy to obtain and unique enough to tell if the request came from more than 1 device

@nielsvanvelzen
Copy link
Member

I'm trying to fix. If 3 TVs connect to the same server, they all present the same UA.

If all of those devices use the same app version that is intended behavior. The user agent is to meant to identify the app, not the device.

@knighthat
Copy link
Author

I think the conversation is derailed from what I intended.

My main goal is to make all requests submit the same UA. So it can be either sdk's UA, or user's custom string.

btw, this is "the same" implementation on Android app, why don't we do the same?

image

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants