# HTTP 307 doesn't keep headers

**URL:** <https://community.gatling.io/t/http-307-doesnt-keep-headers/1910>\
**Category:** Gatling (Open-Source)\
**Created:** [January 17, 2015, 12:32am UTC](https://community.gatling.io/t/http-307-doesnt-keep-headers/1910 "2015-01-17T00:32:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kraj47652](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@kraj47652](https://community.gatling.io/u/kraj47652)\
**Post date:** [January 17, 2015, 12:32am UTC](https://community.gatling.io/t/http-307-doesnt-keep-headers/1910/1 "2015-01-17T00:32:30Z")

</div>

Hi,

I’m new to use Gatling and i’m facing some issues with it.

Indeed, my get request doesn’t keep the headers when there is a redirection. Do you have any suggestions for me?

Here how I’m doing:

val httpConf = http  
.baseURL(“[http://url](http://url)”)  
.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,_/_;q=0.8”)  
.acceptLanguageHeader(“en-US,en;q=0.5”)  
.acceptEncodingHeader(“gzip, deflate”)  
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0”)

val header\_1 = Map(“Content-Type” → “application/x-www-form-urlencoded”, some → “header” , … )

val scn = scenario(“Scenario 1”)  
.exec(http(“request\_1”)  
.get("/xxx")  
.headers(headers\_1)

setUp(scn.inject(atOnceUsers(1)).protocols(httpConf))

Thanks you!

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [January 17, 2015, 7:13am UTC](https://community.gatling.io/t/http-307-doesnt-keep-headers/1910/2 "2015-01-17T07:13:12Z")

</div>

Are you talking about request or response headers?  
Which headers exactly?  
What makes you think that those should be kept?  
Can you share a reproducer?

---

<div class="post-metadata">

**Author:** ![kraj47652](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@kraj47652](https://community.gatling.io/u/kraj47652)\
**Post date:** [January 18, 2015, 6:17pm UTC](https://community.gatling.io/t/http-307-doesnt-keep-headers/1910/3 "2015-01-18T18:17:28Z")

</div>

Hello,

Thanks you for helping.

I’m taking about the request headers. (headers\_1 in my example)

When i’m doing wget with my header, i see the redirection with the headers and i get the good response:

wget -d --header=“header1” --header=“header2/” --header=“header3” [http://url/](http://url/)

I’ll try to share a reproducer but i don’t know if i can. Do you know if we can somehow force the headers?

Thanks again.  
Raj

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [January 18, 2015, 7:02pm UTC](https://community.gatling.io/t/http-307-doesnt-keep-headers/1910/4 "2015-01-18T19:02:22Z")

</div>

I’m having a hard time finding out which headers should be propagated. As usual, RFCs are incomplete at best…  
Gatling currently have a close list of propagated headers: [https://github.com/gatling/gatling/blob/master/gatling-http/src/main/scala/io/gatling/http/ahc/AsyncHandlerActor.scala#L61-L68](https://github.com/gatling/gatling/blob/master/gatling-http/src/main/scala/io/gatling/http/ahc/AsyncHandlerActor.scala#L61-L68)

If anyone could help find a pointer to the proper behavior, I’d gladly implement it.

Cheers,

---

<div class="post-metadata">

**Author:** ![kraj47652](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@kraj47652](https://community.gatling.io/u/kraj47652)\
**Post date:** [January 20, 2015, 11:51pm UTC](https://community.gatling.io/t/http-307-doesnt-keep-headers/1910/5 "2015-01-20T23:51:38Z")

</div>

The problem is that my headers was not usual headers.

So, the solution for my issue was to disable the redirection and use the “location” header who contains the url of the redirection to make another call with the headers of my first request:

.exec(http(“Get 1”)  
.get(url\_1)

.disableFollowRedirect  
.headers(headers\_1)  
.check([status.is](http://status.is)(307))  
.check(header(“Location”).find.saveAs(“redirect\_url”)))  
.pause(1)  
.exec(http(“Get redirection”)  
.get(url\_2)  
.headers(headers\_1)  
.check([status.is](http://status.is)(200)))

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [January 21, 2015, 7:24am UTC](https://community.gatling.io/t/http-307-doesnt-keep-headers/1910/6 "2015-01-21T07:24:18Z")

</div>

That’s the workaround.  
But I will fix it properly: [https://github.com/gatling/gatling/issues/2521](https://github.com/gatling/gatling/issues/2521)

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [January 21, 2015, 10:01am UTC](https://community.gatling.io/t/http-307-doesnt-keep-headers/1910/7 "2015-01-21T10:01:28Z")

</div>

Fixed, thanks for reporting!
