Stack!
The strange situation I'm facing with. I have a code, that is dead-simple:
fetch('https://www.o2.pl').then((response) => console.log(response.status));
I tried this with
- both fetch and node-fetch
- with/without credentials included
- with/without NODE_TLS_REJECT_UNAUTHORIZED
- with/without various 'cors' modes
- different combinations of above
But all requests return a mysterious 449 Retry With code with no additional info. I also tried to copy-paste all the headers that are sent by default by curl in my fetch request. No luck.
At the same time if I make the same call on the same machine with curl or Postman I get back a normal 200 with content. The same code with 'google' works as expected too.
I used node v18, v20 and v22 but the result is always the same - 449 code.
So, I'm missing something, but what? Any suggestions or ideas would be appreciated!
Thank you
** EDIT 02.11.2024 **
Interesting to point out: I tried the same request with BUN and it just worked - I've got 200 response.
https://www.o2.pl, which is not a "real" HTTP code, and we can assume means that this website is telling you that it doesn't like what you're doing, and to stop doing it. So start by explaining why you think fetching that URL should work, at all? Is it your website?