Cant use influx-node with reverse proxy

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

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..

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?

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

Where you mean should I raise the issue?

??? 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?"

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.

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?

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

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:

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

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

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.

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..? :frowning:

$ 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'

Read the built in help...

Search the forum

try the examples in the flow library

try the examples in the cookbook

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

EDIT...
and it would be good for the community if you raise this issue on the issues pages for the node-red-contrib-influxdb node. they are very active & I am certain will take a look at your issue.

done!

1 Like

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

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

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.

:slight_smile: I know exactly what they do

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.

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

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 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?