All my samplers are Java samplers, so I am pretty much doing what you suggest
in my code, but I worked out that the BasicDomainHandler, used by the
CookieSpec handler, will allow the Cookie if I post process the set-cookie and
change the provided domain from api.xxx to just xxx and set the domanSpecified
to true
c.setDomain("xxx");
c.setDomainSpecified(true);
Thanks
> -----Original Message-----
> From: 易, [mailto:[email protected]]
> Sent: Friday, 2 June 2017 12:09 PM
> To: JMeter Users List
> Subject: Re: Sending cookies to non origin domains
>
> You can add "JSR223 PostProcessor" as the child of your sampler. Then put
> the following code in the script, now you can change the domain of all your
> cookies to the new domain.
>
> import org.apache.jmeter.protocol.http.control.CookieManager;
> import org.apache.jmeter.protocol.http.control.Cookie;
>
> CookieManager manager = sampler.getCookieManager(); int count =
> manager.getCookieCount(); for(int i=0;i<count;i++){ Cookie cookie =
> manager.get(i); cookie.setDomain(vars.get("domain"));
> }
>
> 2017-06-02 6:57 GMT+08:00 Antony Bowesman <
> [email protected]>:
>
> > Hi,
> >
> > I am using JMeter 3.1, HttpClient4 and HC4CookieHandler and after
> > login am getting .ASPXAUTH cookies sent to me for domain
> >
> > api.xxx
> >
> > Our real clients are then sending those cookies back to
> >
> > services.xxx
> >
> > which then talks to api.xxx and of course forwards the cookies.
> >
> > However, jmeter is (correctly) not sending the cookie from api.xxx
> > back to services.xxx, so when the request goes internally to api.xxx
> > that thinks I am not logged in.
> >
> > Is there any way I can get JMeter to send those cookies back to the
> > non originating domain?
> >
> > Cheers
> > Antony
> >
> >
>
>
> --
> Best Regards
>
> Wei