Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(agent): Add authorization and user-agent when watching remote configs #16546

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

srebhan
Copy link
Member

@srebhan srebhan commented Feb 24, 2025

Summary

When watching remote (http) configuration files we do issue a HEAD request to find out if the config changed. However, this request is currently missing the authentication header and therefore those requests fail if the endpoint requires authentication.
This PR adds the authentication header if a token is specified and also sends the Telegraf user agent in the request.

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #16545

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Feb 24, 2025
@telegraf-tiger
Copy link
Contributor

@srebhan srebhan self-assigned this Feb 24, 2025
@razvancicu
Copy link

Issue solved! 👍
Here are the logs from the HEAD requests, highlighting the Authorization header:

netutils  | 2025-02-24 16:09:49,936 - net_utils.telegraf_config.api.v1.snmp.ups - snmp_config():38: - INFO - Request headers: {'host': 'netutils:8099', 'user-agent': 'Telegraf/1.34.0-2e157ad0 Go/1.23.5', 'authorization': '****'}

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Feb 24, 2025
@srebhan srebhan assigned DStrand1 and unassigned srebhan Feb 24, 2025
@DStrand1 DStrand1 merged commit e5f7caa into influxdata:master Feb 24, 2025
26 of 27 checks passed
@github-actions github-actions bot added this to the v1.33.3 milestone Feb 24, 2025
srebhan added a commit that referenced this pull request Feb 25, 2025
asaharn pushed a commit to asaharn/telegraf that referenced this pull request Mar 10, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area/agent fix pr to fix corresponding bug ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding Authorization header for HEAD requests
3 participants