# Output all redirect headers and their status codes

**URL:** <https://community.n8n.io/t/output-all-redirect-headers-and-their-status-codes/9353>\
**Category:** Questions\
**Created:** [November 23, 2021, 9:44am UTC](https://community.n8n.io/t/output-all-redirect-headers-and-their-status-codes/9353 "2021-11-23T09:44:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vnmdr-ap](https://avatars.discourse-cdn.com/v4/letter/v/b487fb/32.png) [@vnmdr-ap](https://community.n8n.io/u/vnmdr-ap)\
**Post date:** [November 23, 2021, 9:44am UTC](https://community.n8n.io/t/output-all-redirect-headers-and-their-status-codes/9353/1 "2021-11-23T09:44:55Z")

</div>

Hi there,

I have been trying to figure it out alone but know that there are way smarter people than me in this community.

At the beginning of my workflow, I have a list of domains I need to check whether they are actually resolving. Not interested in the data the HTTP returns but in the headers. Here a simple HTTP Request node does the job perfectly (with some customizations for error handling).

At the same time, if the website I am making a request to redirects to another website/URL (eg. redirecting from HTTP:// to HTTPS:// or from non-www to www-version of the website), I want to get the redirect chain, with its corresponding values.

To illustrate the desired behavior, example flow would be:

Input domain - [example.com](http://example.com)  
GET “[http://example.com](http://example.com)” ==\>  
==\> response “301” with a value of “[https://example.com](https://example.com)” ==\>  
==\> response “301” with a value of “[https://www.example.com](https://www.example.com)” ==\>  
==\> response “200” with a value of “[https://www.example.com](https://www.example.com)” (Stop here, since this is a final redirect)

And the output would be this redirect chain.

Basically, I want to see if I can replicate a similar behavior to [https://httpstatus.io/](https://httpstatus.io/) with N8N . At the end of the day, all that information already resides in N8N and I am trying to figure out how can I get info as an output.

Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [November 23, 2021, 10:33am UTC](https://community.n8n.io/t/output-all-redirect-headers-and-their-status-codes/9353/2 "2021-11-23T10:33:50Z")

</div>

So a simple way to get the redirect chain could be the [https://deref.link/](https://deref.link/) service suggested by @Spacewalker:

> [@Dereferencing a link](http://community.n8n.io/t/dereferencing-a-link/9213):
>
> Hello Everyone! I’m trying to dereference a link using N8N. I have found this website that automatically returns the dereferenced link : [https://deref.link/](https://deref.link/) . What I would like to do is use their API to send an HTTP POST request to their website to get back a JSON with the dereferenced link. On their website, they have a very brief API explanation on how to do that, and it seems like it could be very simple to do, but I have no clue on how to start. I’d appreciate a lot some help …

This seems to be free and works well with n8n, so might be worth checking out. An even simpler alternative (which is also free for less than 500 requests per month) would be One Simple API for which @Jon built a [node](https://docs.n8n.io/nodes/n8n-nodes-base.oneSimpleApi/#one-simple-api) recently.

None of these would provide the exact status codes though, so if you need to get these as well you would need to implement the logic yourself. This can get a bit messy though compared to the above. Here’s an example handling a single URL:

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/4/4f0ab97f1aa28107d3cba5346cb2281a369ca7ad.png) ![image](https://europe1.discourse-cdn.com/n8n/original/2X/6/6bb0a8228007330fa5486c2911b1ef0a3a091ceb.png)

> **Example Workflow**
>

---

<div class="post-metadata">

**Author:** ![vnmdr-ap](https://avatars.discourse-cdn.com/v4/letter/v/b487fb/32.png) [@vnmdr-ap](https://community.n8n.io/u/vnmdr-ap)\
**Post date:** [November 23, 2021, 2:45pm UTC](https://community.n8n.io/t/output-all-redirect-headers-and-their-status-codes/9353/3 "2021-11-23T14:45:45Z")

</div>

Hey @MutedJam !

This is awesome, I was trying to think of other terms to describe this process, and dereferencing is spot on! Thanks for the example workflow, it is of great help (for a long time wanted to understand how to build loops)

Now, this actually prompts me to see if there are any npm packages that I can include in my n8n build (already building an image as needed a few additional tools) to simply it.

OneSimpleAPI would be an option too but once you have over 500 requests, it will become prohibitively expensive for a fairly trivial need (following redirects).

Will tinker further and update the thread once I have more information!

---

<div class="post-metadata">

**Author:** ![Ajetomobi\_Ifeoluwa](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ajetomobi_ifeoluwa/32/73554_2.png) [@Ajetomobi\_Ifeoluwa](https://community.n8n.io/u/Ajetomobi_Ifeoluwa)\
**Post date:** [April 16, 2025, 5:58pm UTC](https://community.n8n.io/t/output-all-redirect-headers-and-their-status-codes/9353/4 "2025-04-16T17:58:48Z")

</div>

Thank you. this really help
