1

When trying to figure out why I was getting an error 403 while making a get request, I came across this post, that offered a solution by adding the header:

'Cookie': 'troute=t1'

to the request. I also found another post that mentions the same solution, but doesnt provide any guidance as to what it actually means, or how to utilize this setting? in other request libraries.

Does anyone have any idea what this cookie means? and how I could use the same sort of setting in a nodejs library such as got, fetch etc.

** For context, the specific request Im trying to make is to download a csv from the nasdaq website:

curl -L -H 'User-Agent: Mozilla' -H 'Cookie: troute=t1;'  'https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=&render=download'

Using a similar request in got/fetch just responds with an error message saying the cookie property is not settable in fetch, and Response code 403 from got.

ie:

const got = require("got");
const url = "https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=&render=download";

got(url { http2: true, headers: {'user-agent': 'Mozilla', cookie:'troute=t1' }}).text();
Justin Dalrymple
  • 630
  • 9
  • 15

0 Answers0