Is there a way to set common HTTP request headers for the whole workflow?

This page summarizes the projects mentioned and recommended in the original post on /r/nodered

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • Node RED

    Low-code programming for event-driven applications

  • [{"id":"6b2f788aaa4ce80b","type":"function","z":"2d37aab2.faf71e","name":"format cookies/headers","func":"// comment out the below line to use the http request nodes editor to select the method\nmsg.method = \"GET\";\n//msg.method = \"POST\";\n//msg.method = \"PUT\";\n//msg.method = \"DELETE\";\n//msg.method = \"HEAD\";\n\n// comment out the below line to use the http request nodes editor to select the url\nmsg.url = \"https://nodered.org\";\n\nmsg.headers = {};\nmsg.headers[\"User-Agent\"] = global.get(\"userAgent\", \"file\");\n\nmsg.cookies = global.get(\"cookie\", \"file\");\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":760,"wires":[["e846f404ae8e78a6"]]},{"id":"5a57788862c8ac6b","type":"function","z":"2d37aab2.faf71e","name":"set global cookies/userAgent","func":"if (typeof msg.userAgent == \"string\") {\n global.set(\"userAgent\", msg.userAgent, \"file\");\n} else {\n node.error(\"msg.userAgent must be a string\");\n};\n\nif (typeof msg.cookie == \"object\") {\n global.set(\"cookie\", msg.cookie, \"file\");\n} else {\n node.error(\"msg.cookie must be an object\");\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":720,"wires":[["3869f26e82ca82c3"]]},{"id":"fb66b6db9cc6f7f1","type":"inject","z":"2d37aab2.faf71e","name":"examples","props":[{"p":"userAgent","v":"\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0\"","vt":"str"},{"p":"cookie","v":"{\"example\": \"This is just an example cookie.\"}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":300,"y":720,"wires":[["5a57788862c8ac6b"]]},{"id":"7f1fb81d526efa9a","type":"inject","z":"2d37aab2.faf71e","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":310,"y":760,"wires":[["6b2f788aaa4ce80b"]]},{"id":"e846f404ae8e78a6","type":"http request","z":"2d37aab2.faf71e","name":"","method":"use","ret":"txt","paytoqs":"body","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":710,"y":760,"wires":[["26937a6179fa1663"]]},{"id":"26937a6179fa1663","type":"debug","z":"2d37aab2.faf71e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":850,"y":760,"wires":[]},{"id":"3869f26e82ca82c3","type":"debug","z":"2d37aab2.faf71e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":850,"y":720,"wires":[]},{"id":"e0bc6038c6489543","type":"comment","z":"2d37aab2.faf71e","name":"You will want to change these examples","info":"","x":210,"y":680,"wires":[]}]

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts