Skip to content

feat: add origin-bound custom request headers - #2192

Open
laugmanuel wants to merge 1 commit into
nextcloud:masterfrom
laugmanuel:feat/5821-custom-request-headers
Open

laugmanuel wants to merge 1 commit into
nextcloud:masterfrom
laugmanuel:feat/5821-custom-request-headers

Conversation

@laugmanuel

@laugmanuel laugmanuel commented Oct 31, 2026 •

Copy link
Copy Markdown

Allow additional request headers, for example the credentials of a pre-authentication proxy

This fixes nextcloud/android#5821

  • CustomHeaders is a process wide registry keyed by the normalized origin (lower case, internationalized hosts in punycode, default port omitted). Only https origins and valid header names and values are accepted; reserved names like Authorization, Cookie or Host are rejected. Origins can be unregistered again.
  • NextcloudClient and PlainClient add the headers through a network interceptor, so every hop of a redirect chain is checked and headers never follow a redirect to another origin.
  • OwnCloudClient applies the headers before each execution and redirect hop. Headers injected for the previous hop are removed, values set by the operation itself are restored.
  • The registry lives in memory; persisting and restoring the headers is up to the app.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI Claude Code with Claude Opus 5.5

Allow additional request headers, for example the credentials of a
pre-authentication proxy

- CustomHeaders is a process wide registry keyed by the normalized origin
  (lower case, internationalized hosts in punycode, default port
  omitted). Only https origins and valid header names and values are
  accepted; reserved names like Authorization, Cookie or Host are
  rejected. Origins can be unregistered again.
- NextcloudClient and PlainClient add the headers through a network
  interceptor, so every hop of a redirect chain is checked and headers
  never follow a redirect to another origin.
- OwnCloudClient applies the headers before each execution and redirect
  hop. Headers injected for the previous hop are removed, values set by
  the operation itself are restored.
- The registry lives in memory; persisting and restoring the headers is
  up to the app.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Manuel Laug <laugmanuel@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom headers for all requests

1 participant