Can the http request node automatically add proxy headers? If not, should it?

We develop many flows to be intermediate "APIs" for web apps/pages served from node-red... using this type of flow pattern:

http in --> change (inputs) --> http request --> change (outputs) --> http resp

So essentially each flow is a smart "forward proxy" request handler -- and I would like the server on the target end of the http request to know the original client's remoteIP address. It seems the standard implementations in proxies like NginX is to append the incoming remoteAddr to a list of IPs in the X-Forwarded-For header, and replace the remoteAddr with the proxy server's IP address, right?

But instead of expecting each of our developers to do the proxy headers dance inside of the flow nodes, I'm wondering if it would be a good idea for the http request core node to support that natively? Like maybe a new checkbox for 'Apply Forward Proxy Headers' or some such verbiage.

If that is not advisable, would some middleware solution be a better option? Thanks for any advise or opinions.
__
Steve

Hi Steve, yes, that is the standard I believe.

I'm guessing, since I don't think this has come up before, that it is not a common requirement?

But I'm sure it could be done. Though would you want to check whether the Node-RED server's IP was not already in the proxy list and then to add it since it is effectively also acting as a proxy?

I think you would also want to ask carefully whether exposing this data to the request target is wise. It might not be in quite a few situations I would think.

As for other middleware to do the job, if you already have a proxy, simply proxy the request URL as well. :slight_smile:

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