Skip to content
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

feat: add support for custom headers #161

Merged
merged 2 commits into from
Jun 26, 2023

Conversation

AndreasPB
Copy link
Contributor

@AndreasPB AndreasPB commented Apr 13, 2023

  • Adds support for adding custom headers to the collector

Example:

go run apache_exporter.go --custom_headers=Cookie=do_something=1 --custom_headers=Cookie=something_else

This is something we use at work and wanted to share :)

#71

@AndreasPB
Copy link
Contributor Author

I forgot to run go fmt 🙈 - It should pass CI now, @Lusitaniae

@Lusitaniae
Copy link
Owner

thanks, looks good!

@dswarbrick
Copy link
Contributor

dswarbrick commented Apr 15, 2023

Reading the original motivation for this (#71), it seems like adding a an Accept header should just be something that any well-written application should do.

The User-Agent header is something that blackbox_exporter recently added, and I agree this makes it a lot nicer when trying to filter out monitoring requests from access logs.

But beyond those, what other custom headers are really needed? Authentication?

@AndreasPB
Copy link
Contributor Author

But beyond those, what other custom headers are really needed? Authentication?

We have been using it to set a Cookie that controls how Apache looks at the login sessions

@AndreasPB
Copy link
Contributor Author

AndreasPB commented May 9, 2023

Should I make some changes, or what is the status of this? @Lusitaniae

I could add the accept header (defaulting to */*?) as a separate command (maybe in a different PR).

Copy link
Collaborator

@blkperl blkperl left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@AndreasPB
Copy link
Contributor Author

Do I need to do something?

@Lusitaniae Lusitaniae merged commit 6b843ee into Lusitaniae:master Jun 26, 2023
@Lusitaniae
Copy link
Owner

No need, many thanks

Merged and released in https://github.com/Lusitaniae/apache_exporter/releases/tag/v1.0.0

if you'd like to test

@AndreasPB
Copy link
Contributor Author

Perfect, thank you :)

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.

4 participants