How to add the right header to a http request node?

Hi,
i don't understand how to add a header for an http request node.
I want to use a GET for the URL "https://www.minecraft.net/en-us/download/server/bedrock". But i only get a timeout error. The reason seems to be the missing header during the request.
I tried several ideas to set the header with the function node, but without success. Any ideas how to get the http request node working with this URL?

Thx
Pag.

If you know which headers you need this cookbook entry may help
https://cookbook.nodered.org/http/set-request-header

That's maybe one of my problems. I can't identify what's needed.
This tutorial i already tried without any success.

Open the link in your browser, open devtools (usually F12), select the network tab, refresh your page, look at the request details you will see all the headers used by your browser.

Follow the coup once again and add these headers.

Hello .. did you get this resolved ?

I was playing around a bit with this and apparently you have to make two requests to the same url
one to establish a connection to the server and get a cookie
and with the second to pass that cookie along to get to the actual website

[{"id":"867b6b9672d87079","type":"inject","z":"54efb553244c241f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":1040,"wires":[["78f483f677659b18"]]},{"id":"507b096eaaa97cfa","type":"http request","z":"54efb553244c241f","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.minecraft.net/en-us/download/server/bedrock","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":490,"y":1040,"wires":[["765707680a2fef55","c5cac10dd8331c31"]]},{"id":"cc7827b303c08904","type":"debug","z":"54efb553244c241f","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":990,"y":1040,"wires":[]},{"id":"78f483f677659b18","type":"function","z":"54efb553244c241f","name":"initial req","func":"msg.headers = {\n    \"User-Agent\": \"PostmanRuntime/7.29.0\",\n    \"Accept\": \"*/*\",\n    \"Cache-Control\": \"no-cache\",\n    \"Host\": \"www.minecraft.net\",\n    \"Accept-Encoding\": \"gzip, deflate, br\"\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":1040,"wires":[["507b096eaaa97cfa"]]},{"id":"765707680a2fef55","type":"function","z":"54efb553244c241f","name":"set Cookies","func":"msg.cookies = msg.responseCookies;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":1040,"wires":[["0f2bac5c29abdda5"]]},{"id":"0f2bac5c29abdda5","type":"http request","z":"54efb553244c241f","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.minecraft.net/en-us/download/server/bedrock","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":850,"y":1040,"wires":[["cc7827b303c08904"]]},{"id":"c5cac10dd8331c31","type":"debug","z":"54efb553244c241f","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":610,"y":980,"wires":[]}]

dont know what that gibberish reply is in the payload of the first request

1 Like

Sorry for my late response. That was a great help for my task. Thank you so much!

1 Like

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