# Relaying cookies in subsequent requests

**URL:** <https://community.gatling.io/t/relaying-cookies-in-subsequent-requests/276>\
**Category:** Gatling (Open-Source)\
**Created:** [February 20, 2013, 3:43pm UTC](https://community.gatling.io/t/relaying-cookies-in-subsequent-requests/276 "2013-02-20T15:43:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Azenstein](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@Eugene\_Azenstein](https://community.gatling.io/u/Eugene_Azenstein)\
**Post date:** [February 20, 2013, 3:43pm UTC](https://community.gatling.io/t/relaying-cookies-in-subsequent-requests/276/1 "2013-02-20T15:43:13Z")

</div>

Hi  
I seem to have a problem with relaying session identification cookie to subsequent requests after initial login.  
Here is a very simple simulation that I am trying to run (with actual URLs removed):

package basic

import com.excilys.ebi.gatling.core.Predef.\_  
import com.excilys.ebi.gatling.http.Predef.\_  
import com.excilys.ebi.gatling.jdbc.Predef.\_  
import com.excilys.ebi.gatling.http.Headers.Names.\_  
import akka.util.duration.\_  
import bootstrap.\_

class MluiSearchAPISimulation extends Simulation {

val main\_httpConf = httpConfig  
.baseURL(“[https://mylocalserver:8443/mlui/home/search](https://mylocalserver:8443/mlui/home/search)”)  
.acceptCharsetHeader(“ISO-8859-1,utf-8;q=0.7,_;q=0.3")  
.acceptHeader("text/html,application/xhtml+xml,application/xml,application/json,text/javascript;q=0.9,_/\*;q=0.8”)  
.acceptEncodingHeader(“gzip,deflate,sdch”)  
.acceptLanguageHeader(“en-US,en;q=0.8”)

val main\_scn = scenario(“Index (empty initial index)”)  
.exec(  
http(“login\_page”)  
.get(“[https://externalLoginServer/login/](https://externalLoginServer/login/)”)  
.check(status.is(200)))  
.pause(2 seconds)  
.exec(  
http(“login\_form\_post”)  
.post(“[https://externalLoginServer/login.sdo](https://externalLoginServer/login.sdo)”)  
.param(“luser”,"")  
.param(“lpass”,"")  
.param(“cookiesEnabled”,“true”)  
.param("\_save",“Login”))  
.pause(2 seconds)  
.exec(  
http(“index\_request\_1”)  
.post("/index")  
.param(“fileId”,“100”)  
.param(“imageTitle”,“sunset in the mountains.jpg”)  
.param(“imageDescription”,“beautiful sunset in the mountains”)  
.param(“tags”,“sunset mountains”)  
.check(status.is(200)))

// run the scenario with 1 user making 1 index index request  
setUp(main\_scn.users(1).protocolConfig(main\_httpConf))  
}

I need a specific cookie named “sso\_so” to be relayed to my local server after login. That cookie serves as a session identifier of sorts.  
What I have noticed, is that in the response that I get from the login request, I get the following 4 headers( this is according to Chrome built-in debugger):

1. Set-Cookie:  
BIGipServerD100\_SSO=1404872896.36895.0000; Path=/

2. Set-Cookie:  
d1\_sso\_cid=d1-sso952; Path=/; domain=.; Secure; HttpOnly

3. Set-Cookie:  
Domain=.; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/

4. Set-Cookie:  
sso\_so=QPCaGeod2Mlsi9ICU1Jbo9PiT24rNO7H3GDXJs4tWbFglooOHHIF8mJDcLx; Path=/; domain=.; Secure; HttpOnly

As you can see, the last header contains the necessary cookie. But it somehow does not get relayed when I send the last request in the chain.

Could it be that:

a. Since domain of login server and my local server are different - Gatling does not relay the cookie?  
b. Since there is more than one header in the response with the name “Set-Cookie”, the one with the right cookie value gets overridden somewhere inside of Gatling?

Thanks in advance for your time!

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [February 20, 2013, 3:47pm UTC](https://community.gatling.io/t/relaying-cookies-in-subsequent-requests/276/2 "2013-02-20T15:47:13Z")

</div>

Hi,

Why version of Gatling do you use?

---

<div class="post-metadata">

**Author:** ![Eugene\_Azenstein](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@Eugene\_Azenstein](https://community.gatling.io/u/Eugene_Azenstein)\
**Post date:** [February 20, 2013, 3:50pm UTC](https://community.gatling.io/t/relaying-cookies-in-subsequent-requests/276/3 "2013-02-20T15:50:11Z")

</div>

If I am not mistaken, 1.4.1.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [February 20, 2013, 3:52pm UTC](https://community.gatling.io/t/relaying-cookies-in-subsequent-requests/276/4 "2013-02-20T15:52:34Z")

</div>

A similar issue was fixed in 1.4.3: [https://github.com/excilys/gatling/wiki/Changelog#wiki-1.4.3](https://github.com/excilys/gatling/wiki/Changelog#wiki-1.4.3)

Could you upgrade and try again, please?

---

<div class="post-metadata">

**Author:** ![Eugene\_Azenstein](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@Eugene\_Azenstein](https://community.gatling.io/u/Eugene_Azenstein)\
**Post date:** [February 20, 2013, 3:55pm UTC](https://community.gatling.io/t/relaying-cookies-in-subsequent-requests/276/5 "2013-02-20T15:55:17Z")

</div>

I will try in the next few hours. Will report if the issue went away.  
Thank you for quick response!

---

<div class="post-metadata">

**Author:** ![Eugene\_Azenstein](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@Eugene\_Azenstein](https://community.gatling.io/u/Eugene_Azenstein)\
**Post date:** [February 20, 2013, 5:56pm UTC](https://community.gatling.io/t/relaying-cookies-in-subsequent-requests/276/6 "2013-02-20T17:56:21Z")

</div>

Hi Stéphane  
1.4.3 build worked for the scenario that I was describing.  
Problem solved.  
Thanks for quick response!

---

<div class="post-metadata">

**Author:** ![Nicolas\_R](https://avatars.discourse-cdn.com/v4/letter/n/f14d63/32.png) [@Nicolas\_R](https://community.gatling.io/u/Nicolas_R)\
**Post date:** [February 20, 2013, 8:19pm UTC](https://community.gatling.io/t/relaying-cookies-in-subsequent-requests/276/7 "2013-02-20T20:19:15Z")

</div>

I’m glad 🙂
