hassio-addons / addon-glances

Glances - Home Assistant Community Add-ons
https://addons.community
MIT License
153 stars 23 forks source link

Custom headers #467

Closed turbatus closed 4 months ago

turbatus commented 6 months ago

Problem/Motivation

First of all, thank you for your work on creating this excellent add-on! My current problem: I want to use this addon to push Glances data to a cloud InfluxDB instance. The instance is protected by Cloudflare apps. With current implementation I get access denied, and this is normal as Cloudflare expects a service token to be present in the request headers, or some sort of auth to happen before granting access to the said instance.

Expected behavior

Sending data to InfluxDB should happen once correct headers are in place, or authentication is successful.

Actual behavior

"Access denied" message received, when configuring InfluxDB fields. HTTP response body: {"message":"Forbidden. You don't have permission to view this. Please contact your system administrator.","status_code":403, ...

Steps to reproduce

Just configure the addon to send data to a Cloudflare protected instance.

Proposed changes

I am open to any suggestion you might have, here is what I propose: add configuration fields to enter the custom headers (and pass those headers along with the request when session is initiated with the InfluxDB instance).

Below is a configuration example from a similar tool (Telegraf):

# # Configuration for sending metrics to InfluxDB 2.0
 [[outputs.influxdb_v2]]
  urls = ["https://influxdb.cloud.url"]
  ## API token for Org authentication.
  token = "xyz_...token.for.the.instance..."
  ## Organization is the name of the organization you wish to write to; must exist.
  organization = "OrgName..."
  ## Destination bucket to write into.
  bucket = "bucket....."
##Custom headers with service tokens for Cloudflare auth
  http_headers = {"CF-Access-Client-Secret" = "xyz......xyz" , "CF-Access-Client-Id" = "xyz...xyz.access" }

Many thanks in advance.

github-actions[bot] commented 5 months ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!