# When redirected, how to see the URL you´re redirected to?

**URL:** <https://community.postman.com/t/when-redirected-how-to-see-the-url-you-re-redirected-to/6699>\
**Category:** Help Hub\
**Tags:** cheerio\
**Created:** [July 23, 2019, 7:28am UTC](https://community.postman.com/t/when-redirected-how-to-see-the-url-you-re-redirected-to/6699 "2019-07-23T07:28:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrissbaumann](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/chrissbaumann/32/5521_2.png) [@chrissbaumann](https://community.postman.com/u/chrissbaumann)\
**Post date:** [July 23, 2019, 7:28am UTC](https://community.postman.com/t/when-redirected-how-to-see-the-url-you-re-redirected-to/6699/1 "2019-07-23T07:28:30Z")

</div>

Hi,

I´m sending a request which returns a 30x and Postman automatically follows the redirect, which is fine.  
How can I programmatically “see” the URL I´m redirected to, eg in the test tab?

This has been raised as an issue before ([https://github.com/postmanlabs/postman-app-support/issues/319](https://github.com/postmanlabs/postman-app-support/issues/319)), but as I understand the latest comment, the given solution is not working anymore?  
Anyhow, I want to get that value in the test tab, not in some Addon.

Many thanks,  
Christian

---

<div class="post-metadata">

**Author:** ![chrissbaumann](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/chrissbaumann/32/5521_2.png) [@chrissbaumann](https://community.postman.com/u/chrissbaumann)\
**Post date:** [July 24, 2019, 7:37am UTC](https://community.postman.com/t/when-redirected-how-to-see-the-url-you-re-redirected-to/6699/2 "2019-07-24T07:37:00Z")

</div>

This has been answered on Twitter: [https://twitter.com/ambertests/status/1153709610768859136](https://twitter.com/ambertests/status/1153709610768859136)

> After you make the request, the redirect url will be in the temporary request headers

> one can access them via request.headers[“referer”]

---

<div class="post-metadata">

**Author:** ![GIGAMAC](https://avatars.discourse-cdn.com/v4/letter/g/aca169/32.png) [@GIGAMAC](https://community.postman.com/u/GIGAMAC)\
**Post date:** [July 28, 2019, 7:56am UTC](https://community.postman.com/t/when-redirected-how-to-see-the-url-you-re-redirected-to/6699/3 "2019-07-28T07:56:06Z")

</div>

The temporary headers are a great answer.

There is the option of turning off redirects from settings, and using a pre-request script to submit your anticipated redirected urls.

You can then use the redirect information in the 30\* header to set your url for the test…

---

<div class="post-metadata">

**Author:** ![richard1](https://avatars.discourse-cdn.com/v4/letter/r/50afbb/32.png) [@richard1](https://community.postman.com/u/richard1)\
**Post date:** [September 29, 2020, 10:25am UTC](https://community.postman.com/t/when-redirected-how-to-see-the-url-you-re-redirected-to/6699/4 "2020-09-29T10:25:25Z")

</div>

`pm.request.headers.get("Referer")` worked for me in Postman 7.32.0

---

<div class="post-metadata">

**Author:** ![calittle](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/calittle/32/15755_2.png) [@calittle](https://community.postman.com/u/calittle)\
**Post date:** [May 5, 2023, 2:21pm UTC](https://community.postman.com/t/when-redirected-how-to-see-the-url-you-re-redirected-to/6699/5 "2023-05-05T14:21:41Z")

</div>

In PM 10.\* you should see this in the console log as a GET http:\xxxx \>302 followed by a GET https:\xxx 200.

---

<div class="post-metadata">

**Author:** ![nehakakar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/nehakakar/32/16165_2.png) [@nehakakar](https://community.postman.com/u/nehakakar)\
**Post date:** [July 22, 2023, 12:04pm UTC](https://community.postman.com/t/when-redirected-how-to-see-the-url-you-re-redirected-to/6699/6 "2023-07-22T12:04:06Z")

</div>

Using the **pm.response.headers** object in the test tab of Postman,  
you may programmatically get the URL you’re being redirected to.  
You can specifically look at the **Location header** , which typically includes the URL to which you were forwarded following a **30x** answer.

Ex:

```auto
// Check if the response has a redirect status code (30x)
if (pm.response.code >= 300 && pm.response.code < 400) {
  // Get the 'Location' header from the response headers
  var redirectUrl = pm.response.headers.get('Location');
  console.log('Redirected URL: ', redirectUrl);
}

```

On this **pm.response.headers.get(‘Location’)** method retrieves the value of the **Location** header from the response headers, which should contain the URL you were final redirected to.

You can verify your URL on this tool **[https://redirectchecker.com](https://redirectchecker.com)** to get detail redirection path.
