Is there a way that for each http request a different ip will be used? I've seen that a httpquest node has an option for proxy, but I don't know how it works
Proxy option is for where connections outside your local network are made through a proxy server. The usual reason for this is in a corporate environment where all access outside the local network must go through a proxy for security reasons. You would provide the proxy information needed in this property.
If you do have multiple proxy servers that can be used to make the requests, you could set a different proxy for different requests. But you would have to have these proxy servers already set up - Node-RED will not magically create them or give your requests a different IP through the use of this property.
Thanks, I do have a list of proxy's.
I do know how to do a http request with multiple urls. But I wonder if this below would also be possible for the proxy part
Set the URL of a request using a template : Node-RED so for example set msg.proxy
here my own variant to request multiple url's
[{"id":"b82f3286.2389a","type":"inject","z":"66dec428.a8fdbc","name":"Trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":800,"wires":[["e23fe32.a2dda2"]]},{"id":"e23fe32.a2dda2","type":"function","z":"66dec428.a8fdbc","name":"Keywords","func":"// without exclude words\nvar kw1 = { payload: \"http://www.google.com\" };\nvar kw2 = { payload: \"https://www.google.com/search?q=test\" };\nvar kw3 = { payload: \"https://www.google.com/search?q=testtest\" };\n\n\nreturn [ kw1,kw2,kw3];","outputs":3,"noerr":0,"x":500,"y":800,"wires":[["c36ab74c.1a8838"],["720692f0.c8a9dc"],["9eb94a60.0bb548"]]},{"id":"b3a1c017.59b51","type":"change","z":"66dec428.a8fdbc","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":970,"y":740,"wires":[["6ac081af.1b024"]]},{"id":"6ac081af.1b024","type":"http request","z":"66dec428.a8fdbc","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":970,"y":800,"wires":[["4cc14c0d.6c3034"]]},{"id":"c36ab74c.1a8838","type":"delay","z":"66dec428.a8fdbc","name":"","pauseType":"random","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":700,"y":740,"wires":[["b3a1c017.59b51"]]},{"id":"720692f0.c8a9dc","type":"delay","z":"66dec428.a8fdbc","name":"","pauseType":"random","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"10","randomLast":"15","randomUnits":"seconds","drop":false,"x":700,"y":820,"wires":[["b3a1c017.59b51"]]},{"id":"9eb94a60.0bb548","type":"delay","z":"66dec428.a8fdbc","name":"","pauseType":"random","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"5","randomLast":"10","randomUnits":"seconds","drop":false,"x":700,"y":780,"wires":[["b3a1c017.59b51"]]},{"id":"4cc14c0d.6c3034","type":"debug","z":"66dec428.a8fdbc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1150,"y":800,"wires":[]}]
Hi steffok,
I looked at your flow. I'm not sure why you are doing a random delay.
I think what you were trying to do may be to generate a random proxy URL. One way I can think of to do this would be to use a function (javascript) node. In that node, you would have a javascript array of known proxy server addresses.
var proxyservers = ["proxy1", "proxy2", "proxy3"];
You could then generate a random integer to index into that array. For example, if you had 3 proxy servers in the array, you would generate a random integer between 0 and 3 and then use this as an index to the array, like this:
var index = Math.floor(Math.random() * 3);
You could then use index as a subscript into your array. Set a property on the message to the proxy string contained at that array index.
msg.proxytouse = proxyarray[index];
You could then use something like node-red-contrib-http-request-proxy to set the proxy to use to msg.proxytouse, and make your http request through the proxy.
this might be what I need, thanks. Will have a look next week when I have some spare time.
The random delay is for throttling, maybe not the cleanest way but works for me:)
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.