# Cant use influx-node with reverse proxy

**URL:** <https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948>\
**Category:** General\
**Created:** [15 November 2020 11:16 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948 "2020-11-15T11:16:11Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![loeten](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@loeten](https://discourse.nodered.org/u/loeten)\
**Post date:** [15 November 2020 11:16 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/1 "2020-11-15T11:16:11Z")

</div>

Dear all,

i have set up an influx DB on a webserver with apache running on it - to use the https and certificate. I can write to the DB with curl like:

`$ curl -u user:pass -i -X POST 'https:// ********.no-ip.biz/influx/write?db=mydb' -d 'orga,org=innen value=5'`

but I cant with the node red influx node - it says

```auto
Error: A 301 Moved Permanently error occurred: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https:// ********.no-ip.biz/influx:443/write?db=mydb&amp;p=pass&amp;precision=n&amp;rp=&amp;u=user">here</a>.</p>
</body></html>

```

Any chance to fix this? Otherwise, I would use a shell script, curl and exec node..

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 November 2020 11:30 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/2 "2020-11-15T11:30:04Z")

</div>

> [@loeten](#):
>
> Otherwise, I would use a shell script, curl and exec node

Why would that be your second choice? You could use the http request node.

As for the influxdb node, perhaps look at (or raise a new) issues - it may already be covered?

---

<div class="post-metadata">

**Author:** ![loeten](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@loeten](https://discourse.nodered.org/u/loeten)\
**Post date:** [15 November 2020 12:15 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/3 "2020-11-15T12:15:21Z")

</div>

> [@Steve-Mcl](#):
>
> Why would that be your second choice?

Just integrity, script needs extra handling, 3 tools instead 1 etc.

Where you mean should I raise the issue?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 November 2020 12:24 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/4 "2020-11-15T12:24:35Z")

</div>

> [@loeten](#):
>
> Just integrity, script needs extra handling, 3 tools instead 1 etc.

??? That makes zero sense to me i am afraid ???

Using "shell script, curl and exec node" is 3 parts.  
Using request node is 1 node INSIDE node-red (no spawning, no exec, no curl!)

To rephrase my question to be more explicit - "why would you chose to use exec + curl" when you can use a Request node instead?"

> [@loeten](#):
>
> Where you mean should I raise the issue?

On the nodes repository. What node are you using? Tell us the nodes full name or post a link to it on the flows library.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [15 November 2020 13:19 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/5 "2020-11-15T13:19:11Z")

</div>

That's because curl can cope with the redirect that is happening but the node can not. Have you tried calling the redirected URL using an http-request node?

---

<div class="post-metadata">

**Author:** ![loeten](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@loeten](https://discourse.nodered.org/u/loeten)\
**Post date:** [15 November 2020 15:12 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/6 "2020-11-15T15:12:40Z")

</div>

> [@Steve-Mcl](#):
>
> To rephrase my question to be more explicit - "why would you chose to use exec + curl" when you can use a Request node instead?"

Just because Node Red does not work in my case, as @TotallyInformation explained. I will send details laiter today.

---

<div class="post-metadata">

**Author:** ![loeten](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@loeten](https://discourse.nodered.org/u/loeten)\
**Post date:** [15 November 2020 17:12 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/7 "2020-11-15T17:12:44Z")

</div>

ok, details: the module is "node-red-contrib-influxdb" and from there I use an "influxdb out" type node.

I checked here but found nothing about it:

> **[node-red-contrib-influxdb](https://flows.nodered.org/node/node-red-contrib-influxdb)**
>
> Node-RED nodes to save and query data from an influxdb time series database

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [15 November 2020 17:27 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/8 "2020-11-15T17:27:15Z")

</div>

> [@loeten](#):
>
> Just because Node Red does not work in my case

You are missing the point. The influx node will not do the job but the suggestion is to use the http request node instead.

---

<div class="post-metadata">

**Author:** ![loeten](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@loeten](https://discourse.nodered.org/u/loeten)\
**Post date:** [15 November 2020 19:46 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/9 "2020-11-15T19:46:24Z")

</div>

> [@Colin](#):
>
> The influx node will not do the job but the suggestion is to use the http request node instead.

Yes indeed, it is late 🙂 Can I just place the curl statement into it as it is? Will try tomorrow. Good point!

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [15 November 2020 22:43 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/10 "2020-11-15T22:43:09Z")

</div>

You don't really need that node if it isn't working for you. InfluxDB uses an HTTP REST API which that node uses as well. You can throw everything through a standard http-request node instead.

---

<div class="post-metadata">

**Author:** ![loeten](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@loeten](https://discourse.nodered.org/u/loeten)\
**Post date:** [16 November 2020 09:27 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/11 "2020-11-16T09:27:09Z")

</div>

> [@Colin](#):
>
> to use the http request node

Just picked up such a node - but the question is now: How to split correctly the parts of the curl statement (see below the statement from above, parts marked with [1] to [5]) into the form fields of the node (properties), and how to format the message payload? It looks so confusing..? ☹

$ curl -u [1]user:[2]pass -i -X POST '[3]https://\*\*\*\*\*\*\*\*.no-ip.biz/influx/write?[4]db=mydb' -d '[5]orga,org=innen value=5'

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [16 November 2020 09:52 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/12 "2020-11-16T09:52:59Z")

</div>

Read the built in help...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/b/0bf408a3ab7d2d9f43d59f10d030a19bc6c0577a.png)

[Search](https://discourse.nodered.org/search?q=http%20request%20curl) the forum

try the examples in the [flow library](https://flows.nodered.org/search?term=http&type=flow)

try the examples in the [cookbook](https://cookbook.nodered.org/#http-requests)

Basically, just give it a go - if you get stuck, ask a specific question - we will help you out 👍

EDIT...  
and it would be good for the community if you raise this issue on the [issues pages](https://github.com/mblackstock/node-red-contrib-influxdb/issues) for the [node-red-contrib-influxdb](https://flows.nodered.org/node/node-red-contrib-influxdb) node. they are very active & I am certain will take a look at your issue.

---

<div class="post-metadata">

**Author:** ![loeten](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@loeten](https://discourse.nodered.org/u/loeten)\
**Post date:** [16 November 2020 11:45 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/13 "2020-11-16T11:45:15Z")

</div>

> [@Steve-Mcl](#):
>
> if you raise this issue on the [issues pages](https://github.com/mblackstock/node-red-contrib-influxdb/issues) for the [node-red-contrib-influxdb](https://flows.nodered.org/node/node-red-contrib-influxdb) node

done!

> <https://github.com/mblackstock/node-red-contrib-influxdb/issues/70>
>
> I have an apache2-driven webserver with a valid HTTPS certificate setup. I insta…lled InfluxDB on this machine, in order to easily use it's https certificates by inserting into the virtualhosts/443 this lines:
> 
> \`\`\`
> #influx
> ProxyPass "/influx" "http://localhost:8086"
> ProxyPassReverse "/influx" "http://localhost:8086"
> 
> \`\`\`
> 
> I did so, because so I don't need to extra-care for the certificate and ~renewal for influx separately, but wanted to have https traffic for influxdb.
> 
> Now I can use it with curl, but I can't with node-red-contrib-influxdb, because it seems unable to handle the redirection / reverse proxy. More details here in this thread:
> 
> https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [16 November 2020 23:38 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/14 "2020-11-16T23:38:50Z")

</div>

> [@loeten](#):
>
> Just picked up such a node

You don't need one, it is built-in to Node-RED as a code node.

> [@loeten](#):
>
> It looks so confusing..?

Indeed, you may need to do some reading about what the -u and -d parameters in curl actually do 😉

You might find that a REST API tool will help you as well as it will give you more help. There are some good ones that are browse addins - "postman"? I think that rings a bell.

---

<div class="post-metadata">

**Author:** ![loeten](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@loeten](https://discourse.nodered.org/u/loeten)\
**Post date:** [17 November 2020 11:03 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/15 "2020-11-17T11:03:49Z")

</div>

> [@TotallyInformation](#):
>
> you may need to do some reading about what the -u and -d parameters in curl actually do

🙂 I know exactly what they do

> [@TotallyInformation](#):
>
> it is built-in to Node-RED as a code node.

You mean the "exec" node? Yes thats what I will use now.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 November 2020 11:14 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/16 "2020-11-17T11:14:03Z")

</div>

> [@loeten](#):
>
> You mean the "exec" node? Yes thats what I will use now.

No, as we have said about 5 times now, use the built in http request node instead of spawning curl.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 November 2020 16:51 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/17 "2020-11-17T16:51:35Z")

</div>

> [@loeten](#):
>
> > [@TotallyInformation](#):
> >
> > it is built-in to Node-RED as a code node.
> 
> You mean the "exec" node? Yes thats what I will use now.

No, I mean what I said, the http-request node.

---

<div class="post-metadata">

**Author:** ![mike](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mike/32/10_2.png) [@mike](https://discourse.nodered.org/u/mike)\
**Post date:** [19 November 2020 02:05 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/18 "2020-11-19T02:05:23Z")

</div>

Thanks for raising the issue. I've had a look and it doesn't look like something we can add to the node easily given we use the [@influxdata/influxdb-client](https://www.npmjs.com/package/@influxdata/influxdb-client) module and it doesn't seem to support redirect following.

Have you tried using the URL you were redirected to (i.e. `https:// ********.no-ip.biz/influx:443`) to avoid the redirect?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 January 2021 02:05 UTC](https://discourse.nodered.org/t/cant-use-influx-node-with-reverse-proxy/35948/19 "2021-01-18T02:05:23Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
