Proxy Configuration for external API conection

Hi there.

I’m trying to provide a contact URL to an external API as a subscription for some events.

This connection to the external API is usually done without SSL/TLS, just with basic authentication, a token.
At the moment to set the suscription I can only send the URL, no token or certificates, so using the callback of a device is not possible.

So I thought about using a proxy. Using the automatically generated one from influxDB plugin as an example, I configured this one:

image

As I understand it, I need to set the contact URL as follows:

https://thingerURLplaceholder:16

and then I may could receive the events in Node-RED with a “http in” node as:

https://thingerURLplaceholder:14

However, I’m not getting any event and as I’m trying to simulate the external API inside Node-RED (a simple http request node) I’m stuck receiving this error in the mentioned node:

image

Is this the right way?
Is the proxy configured as it should be?
Any help is welcome!
And if any additional information is needed. Just tell me and I will post it!

Thanks in advance,

The external API would use that contact URL to POST when there is an event.

Hi,

If you are not using ssl, I guess need to use http instead https at the address.

I have set up a proxy for other application and at the target host I´ve placed the address of the instance, I dont used the term “localhost”, not sure if this makes a difference, just sharing my experience.

Hope this helps.

Hi @SRG

Additional to what @ega says about using HTTP when not using SSL, you need two things. The proxy should point to the Node-RED plugin and not localhost, and you need to use a custom node to open a custom port, by either using one of this two libraries in Node-RED:
node-red-contrib-http-custom-port
node-red-contrib-http-custom-port-raw

Specially, do not open port 1880 against Node-RED, as it will open the plugins frontend to the whole world.

Hello @ega @jaimebs

Thanks for the quick response and support. I have configured the proxy as commented in the post:

Captura de pantalla 2023-11-29 091640

I also installed the custom port library. But I haven’t had a chance to test it yet. I’m simulating the external API posting with a http request node inside Node-RED and this error keeps appearing:

image

No matter what method I use (POST, PUT, GET…) I always get this message.
The image shows the URL I am posting to.
Is there anything I have not taken into account?

Thanks in advance,

Still not sure, have you ever seen this error message? @jaimebs

Hello @SRG

Given the response of the request I would say that the node that opens the desired port and creates the API has not been placed in a flow or you have no method POST for the path /.

Here is an example flow:

Thank you @jaimebs,

I completely forgot about the http response. Works fine now!