Search code examples
node.jscookiesgetrequestfetch

Autofilling cookies in fetch (like a browser)


I have a fetch request that is getting blocked because I do not have cookies enabled. The error looks on the outside like this:

Error 1020

But I looked at the HTML and it says I need to enable cookies. I looked at various node packages like fetch-cookie, but when I tried to use it, it didn't polyfill the cookies (send the cookies automatically).

Is there a way to automatically send cookies like it's a browser? I know of puppeteer and phantomjs, but I do not want to use these alternatives, I would prefer to use fetch or a type of request.

Thanks


Solution

  • Use a reverse proxy like cors-anywhere to modify the headers.