Skip to content

Add custom headers to inventory request #896

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

Closed
wants to merge 1 commit into from
Closed

Add custom headers to inventory request #896

wants to merge 1 commit into from

Conversation

bloomcake
Copy link
Contributor

Related Issue #895

New Behavior

  • Add custom headers to inventory request

Contrast to Current Behavior

New headers are appended to self.headers to be able to add own headers.

Discussion: Benefits and Drawbacks

...

Changes to the Documentation

...

Proposed Release Note Entry

Add custom headers to inventory request

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.

Copy link
Contributor

@sc68cal sc68cal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be managed via the standard HTTP_PROXY environment variable - https://docs.ansible.com/ansible/2.4/playbooks_environment.html

@sc68cal
Copy link
Contributor

sc68cal commented Dec 3, 2022

pynetbox under the hood uses requests - which honors the standard HTTP_PROXY environment variable and others

https://requests.readthedocs.io/en/latest/user/advanced/?highlight=HTTP_PROXY#proxies

@sc68cal
Copy link
Contributor

sc68cal commented Dec 3, 2022

Basically, I don't want us to have code in our repository that deals with however you've deployed netbox in your environment. There are generally accepted practices for setting up proxies, we have a couple of users who have reported their usage of netbox behind a proxy. You should configure an HTTP(s) proxy, instead of adding code that sets a cookie and make everyone else who ever uses this code support that.

@bloomcake bloomcake closed this Dec 3, 2022
@clinta
Copy link
Contributor

clinta commented Sep 19, 2024

Sadly found this issue trying to figure out how to use this plugin with netbox behind Cloudflare zero trust. I'm not sure how an outbound http proxy is supposed to replace the ability to add custom headers.

@sc68cal
Copy link
Contributor

sc68cal commented Sep 26, 2024

See the linked issue 895, user was using a custom proxy solution which required a custom header to be set in order to work with their proxy setup. I don't wish for us to carry the burden of maintaining how people set up proxies between the various NetBox components (both API clients and the netbox server), since it also has been a source of bug reports where we don't really have a way of fixing it since it's unique to each user's environment.

@clinta
Copy link
Contributor

clinta commented Sep 26, 2024

I can understand that for a complex change. But this change is literally one line (of non-documentation). Also this functionality is explicitly supported by pynetbox, and documented. The implementation does not have any specific logic for dealing with specific proxies, it's just the generic ability to add any headers the user needs.

I've rebased this PR to run my own fork, and added the same functionality to the lookup module. I'd ask you to reconsider and look at what a small change this is.

https://github.com/netbox-community/ansible_modules/compare/master..clinta:custom_headers

@sc68cal
Copy link
Contributor

sc68cal commented Sep 26, 2024

OK, that is a convincing argument to me. Open a PR. I'll 👍

@clinta clinta mentioned this pull request Sep 26, 2024
3 tasks
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.

3 participants