# How to get url from redirect?

**URL:** https://community.gatling.io/t/how-to-get-url-from-redirect/3930
**Category:** Gatling (Open-Source)
**Created:** [September 13, 2017, 10:03am UTC](https://community.gatling.io/t/how-to-get-url-from-redirect/3930 "2017-09-13T10:03:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![anik\_proxi](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@anik\_proxi](https://community.gatling.io/u/anik_proxi)
#### Post date: [September 13, 2017, 10:03am UTC](https://community.gatling.io/t/how-to-get-url-from-redirect/3930/1 "2017-09-13T10:03:50Z")

</div>

Is it possible after send request get a url from redirect to variable? e.g. I request for 192.168.1.30:8080/ and this link redirect me to 192.168.1.30:8080/token/123, can I get /token/123?

val scn = scenario(“Scenario Name”)  
.exec(http(“Open”)  
.get("/"))

---

<div class="post-metadata">

### Author: ![anik\_proxi](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@anik\_proxi](https://community.gatling.io/u/anik_proxi)
#### Post date: [September 14, 2017, 1:02pm UTC](https://community.gatling.io/t/how-to-get-url-from-redirect/3930/2 "2017-09-14T13:02:54Z")

</div>

I tried with this but occurs error header.find.exists, found nothing but in Fiddler I see this header

val scn = scenario(“SCENARIO2”)  
.exec(http(“open”)  
.get("/")  
.check(header(“Location”).saveAs(“url”)))  
.exec(session =\> {  
val urlN = session.get(“url”).asOption[String]  
print("TEST123 " + urlN.getOrElse(“nie ma”))  
session  
})

---

<div class="post-metadata">

### Author: ![Nige](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@Nige](https://community.gatling.io/u/Nige)
#### Post date: [September 14, 2017, 10:39pm UTC](https://community.gatling.io/t/how-to-get-url-from-redirect/3930/3 "2017-09-14T22:39:24Z")

</div>

By default, redirects occur automatically, and any checks are performed only at the last redirection (‘landing’) location, which will not have a ‘Location’ header in the response.

It seems you need to (globally) override this behaviour with disableFollowRedirect applied to your HTTP configuration ( ref. [http://gatling.io/docs/current/cheat-sheet/](http://gatling.io/docs/current/cheat-sheet/) , HTTP Protocol / Options ), and handle redirections yourself. A temporary/local override would be nice, but there isn’t one.

Also see [https://groups.google.com/forum/#!topic/gatling/CfP8hSfcFXs](https://groups.google.com/forum/#!topic/gatling/CfP8hSfcFXs) .
