Skip to content

feat(api): send a Seerr user agent on outbound requests - #3395

Open
MannXo wants to merge 2 commits into
seerr-team:developfrom
MannXo:add-user-agent-header
Open

feat(api): send a Seerr user agent on outbound requests#3395
MannXo wants to merge 2 commits into
seerr-team:developfrom
MannXo:add-user-agent-header

Conversation

@MannXo

@MannXo MannXo commented Aug 14, 2026

Copy link
Copy Markdown

Description

Outbound HTTP calls went out with the default axios user agent, giving third-party services nothing to identify Seerr by.
Added a request interceptor that sets a Seerr/ user agent, and register it the way the proxy interceptor is registered, on the default axios instance and on each axios.create() client. A user agent already set on the request is left alone, so webhook custom headers still win.

How Has This Been Tested?

All new and existing tests passed. Environment ( macOS 26.5.2 arm64, Node 22.22.0, pnpm 10.24.0.)

Screenshots / Logs (if applicable)

not applicable to this case

Checklist:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

I was asssited by Claude (Opus 5) in preparation of this PR, I have reviewed all changes and take full respoinsbility.

Summary by CodeRabbit

  • New Features

    • Added standardized application identification to outgoing API requests through a User-Agent header.
    • Includes the application version automatically and preserves custom request-specific user-agent values.
  • Bug Fixes

    • Improved consistency of user-agent information across supported requests and services.
  • Tests

    • Added coverage for user-agent generation, automatic header application, outgoing request handling, and custom header preservation.

Outbound HTTP calls went out with the default axios user agent, giving
third-party services nothing to identify Seerr by.

Add a request interceptor that sets a Seerr/<version> user agent, and
register it the way the proxy interceptor is registered, on the default
axios instance and on each axios.create() client. A user agent already
set on the request is left alone, so webhook custom headers still win.

Fixes seerr-team#3387
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f0a4312e-8b93-4d38-8bbb-7a15ee100cec

📥 Commits

Reviewing files that changed from the base of the PR and between 1d8d4d0 and 3ddd377.

📒 Files selected for processing (1)
  • server/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/index.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The PR adds centralized Seerr/<version> User-Agent generation. It registers the interceptor on default Axios and on ExternalAPI, TautulliAPI, and ImageProxy clients. Tests verify automatic headers and custom header preservation.

Changes

User-Agent propagation

Layer / File(s) Summary
User-Agent utility and validation
server/utils/userAgent.ts, server/utils/userAgent.test.ts
The utility generates the application User-Agent and adds it when a request lacks one. Tests verify formatting, propagation, request capture, and custom value preservation.
Axios client registration
server/index.ts, server/api/externalapi.ts, server/api/tautulli.ts, server/lib/imageproxy.ts
Server startup loads the default registration. The external API, Tautulli, and image proxy Axios clients register the interceptor.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 3ddd3

The change adds a Seerr user agent to outbound requests while preserving custom request headers, with no actionable merge-blocking risk remaining beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant ServerStartup
  participant AxiosClient
  participant userAgentRequestInterceptor
  participant ExternalService
  ServerStartup->>AxiosClient: Load User-Agent registration
  AxiosClient->>userAgentRequestInterceptor: Process request config
  userAgentRequestInterceptor->>ExternalService: Send Seerr/<version> when User-Agent is absent
  userAgentRequestInterceptor-->>AxiosClient: Preserve custom User-Agent when provided
Loading

Poem

A rabbit hops with headers bright,
“Seerr” leads each request in flight.
Custom words stay safely near,
Defaults become crystal clear.
Axios bounds through fields of green.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: sending a Seerr user agent on outbound API requests.
Linked Issues check ✅ Passed The changes add a Seerr user agent to the default Axios instance and the relevant created Axios clients, while preserving request-specific agents [#3387].
Out of Scope Changes check ✅ Passed All implementation and test changes directly support adding and validating the Seerr user agent for outbound Axios requests [#3387].

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MannXo
MannXo marked this pull request as ready for review August 14, 2026 11:02
@MannXo
MannXo requested a review from a team as a code owner August 14, 2026 11:02
Comment thread server/utils/userAgent.test.ts Dismissed
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.

Add a 'User-Agent' to all axios instances

2 participants