Get Redirect Status Code From Node-Fetch

November - 2021

By default, node-fetch follows redirects and will return a 200 if the target page exists.

To get the status of the original page, set the redirect option to manual. For example:

const fetch = require('node-fetch')

fetch('', {
  redirect: 'manual',
}).then((res) => {

Returns 301

If you want to see the status code of the final page after processing redirects, remove the option