# Telegraf Influxdb plugin with HTTPS

**URL:** <https://community.influxdata.com/t/telegraf-influxdb-plugin-with-https/14684>\
**Category:** Telegraf\
**Tags:** telegraf\
**Created:** [June 4, 2020, 8:49pm UTC](https://community.influxdata.com/t/telegraf-influxdb-plugin-with-https/14684 "2020-06-04T20:49:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigjohnson](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bigjohnson/32/5082_2.png) [@bigjohnson](https://community.influxdata.com/u/bigjohnson)\
**Post date:** [June 4, 2020, 8:49pm UTC](https://community.influxdata.com/t/telegraf-influxdb-plugin-with-https/14684/1 "2020-06-04T20:49:25Z")

</div>

Hello All,  
I have an influxdb/http server behind an Apache https reverse proxy.  
I am really happy with this config, the ssl certs are from Letsencrypt, and my clients use https for data insertion, with curl from linux, with native libraries with Arduino clients.  
Here an example with ESP8266 and arduino: [GitHub - bigjohnson/ESP\_influxdbSSL\_CAcert\_DHT22\_WiFiManager: An arduino sketch to upload DHT22 humidity and temperature on an influxdb database with SSL and Root CA cert](https://github.com/bigjohnson/ESP_influxdbSSL_CAcert_DHT22_WiFiManager)  
I noticed that the Telegraf Influxdb plugin is only HTTP, I read some post that an old version was https.  
I use Telegraf to collect snmp/smartctl data.  
Why not re enable the https that is more secure?  
Thanks.

Alberto

---

<div class="post-metadata">

**Author:** ![daniel](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/daniel/32/142_2.png) [@daniel](https://community.influxdata.com/u/daniel)\
**Post date:** [June 5, 2020, 4:54am UTC](https://community.influxdata.com/t/telegraf-influxdb-plugin-with-https/14684/2 "2020-06-05T04:54:39Z")

</div>

Both the Telegraf input and output plugins for InfluxDB support TLS/https. Perhaps we have some incorrect documentation somewhere, where did you hear that only http is supported?

---

<div class="post-metadata">

**Author:** ![bigjohnson](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bigjohnson/32/5082_2.png) [@bigjohnson](https://community.influxdata.com/u/bigjohnson)\
**Post date:** [June 7, 2020, 4:00pm UTC](https://community.influxdata.com/t/telegraf-influxdb-plugin-with-https/14684/3 "2020-06-07T16:00:03Z")

</div>

I found this old github post, but I think is a resolved issue.  
Actually when i start telegraf with  
`urls = ["https://influxdb.panu.it:443"]`  
and activate the debug on file there is this line  
`2020-06-07T15:46:15Z E! [outputs.influxdb] When writing to [https://influxdb.panu.it:443]: Post https://influxdb.panu.it:443/write?consistency=any&db=telegraf: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)`  
`2020-06-07T15:46:15Z E! [agent] Error writing to outputs.influxdb: could not write any address`  
but with curl and arduino it works.  
Any idea?

---

<div class="post-metadata">

**Author:** ![bigjohnson](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bigjohnson/32/5082_2.png) [@bigjohnson](https://community.influxdata.com/u/bigjohnson)\
**Post date:** [June 7, 2020, 4:01pm UTC](https://community.influxdata.com/t/telegraf-influxdb-plugin-with-https/14684/4 "2020-06-07T16:01:32Z")

</div>

> <https://github.com/influxdata/telegraf/issues/3975>
>
> Introduced in the change 43bd23e5556ba947758cd23af0364ce808add059, the urls for …HTTPS scheme are no longer formatted correctly.
> 
> \`\`\`
> switch u.Scheme {
> case "unix":
> u.Scheme = "http"
> u.Host = "127.0.0.1"
> u.Path = "/write"
> case "http":
> u.Path = path.Join(u.Path, "write")
> }
> \`\`\`
> 
> \`\`\`
> switch u.Scheme {
> case "unix":
> u.Scheme = "http"
> u.Host = "127.0.0.1"
> u.Path = "/query"
> case "http":
> u.Path = path.Join(u.Path, "query")
> }
> \`\`\`
> 
> Both of these switch statements are missing \`\`\`https\`\`\` case.
> 
> Added a log line to \`\`\`makeQueryRequest\`\`\` to see what url was 404ing:
> 
> \`\`\`
> log.Printf("D! \[outputs.influxdb\] Posting query to %s", c.QueryURL)
> \`\`\`
> 
> And produced the following debug output:
> 
> \`\`\`
> ./telegraf.exe --config telegraf.conf
> 2018-04-05T17:10:20Z D! Attempting connection to output: influxdb
> 2018-04-05T17:10:20Z D! \[outputs.influxdb\] Posting query to https://influxdb.example.com:8086
> 2018-04-05T17:10:20Z W! \[outputs.influxdb\] when writing to \[https://influxdb.example.com:8086\]: database "telegraf" creation failed: 404 Not Found
> 2018-04-05T17:10:20Z D! Successfully connected to output: influxdb
> 2018-04-05T17:10:20Z I! Starting Telegraf v1.6.0-rc2
> \`\`\`
> 
> After fixing the switch statements or using http:
> 
> \`\`\`
> ./telegraf.exe --config telegraf.conf
> 2018-04-05T17:10:54Z D! Attempting connection to output: influxdb
> 2018-04-05T17:10:54Z D! \[outputs.influxdb\] Posting query to http://influxdb.example.com:8086/query
> 2018-04-05T17:10:54Z D! Successfully connected to output: influxdb
> 2018-04-05T17:10:54Z I! Starting Telegraf v1.6.0-rc2
> \`\`\`
> 
> You'll notice the query url is correct in the 2nd case.
