Skip to content

Add support for custom headers in all Netbox modules #1433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: devel
Choose a base branch
from

Conversation

benoit-ferre
Copy link
Contributor

@benoit-ferre benoit-ferre commented Jun 30, 2025

Related Issue

Extends the scope of #896

New Behavior

This PR adds the ability to add custom headers to the API requests for all modules. It supports headers in the module arguments.
This PR is inspired by @clinta work in #1327

Contrast to Current Behavior

Currently there is no ability to add custom headers to API requests beyond inventory and lookup module.

Discussion: Benefits and Drawbacks

Custom headers are required for many deployments behind reverse proxies for additional authentication tokens or cookies. This only adds new compatibility and is fully backwards compatible.
It makes also all modules compatible with netbox branching plugin.

Drawback:
This PR modify the signature of the NetboxModule._connect_netbox_api function.

Changes to the Documentation

Documentation has been updated to reflect the new header support and NetboxModule._connect_netbox_api signature change in docs/getting_started/contributing/modules/architecture.rst file.

Proposed Release Note Entry

Add support for custom headers on all modules.

Double Check

  • I have read the comments and followed the CONTRIBUTING.md.
  • I have explained my PR according to the information in the comments or in a linked issue.
  • My PR targets the devel branch.

Add custom header parameter based on @clinta work
in netbox-community#1327
Reflect signature change in the doc file:
`modified:  docs/getting_started/contributing/modules/architecture.rst`
@benoit-ferre benoit-ferre changed the title Custom Header Support For All Modules. Add support for custom headers in all Netbox modules Jun 30, 2025
@benoit-ferre
Copy link
Contributor Author

I saw somme ansible-lint errors on files I don't touch.
I will submit a separate PR to fix them.

image

@benoit-ferre benoit-ferre marked this pull request as ready for review July 1, 2025 15:51
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.

1 participant