Apologies in advance as I’m new to API gateways and routing techniques.
I’m trying to configure Kong for sticky sessions with cookie based routing and I’m trying to use curl requests to verify the session is sticky. What I’m experiencing is that Kong isn’t routing based on the passed in cookie and replaces the cookie. Am I doing something wrong? Is this expected behavior?
My upstream config is very simple:
curl -X POST http://localhost:8001/upstreams \
--data "name=address.v1.service" \
--data "hash_on=cookie" \
--data "hash_on_cookie=foolCookie" \
--data "hash_on_cookie_path=/fool"
I make a request and store the cookie:
$ curl -v -c test.txt http://localhost:8000/foo
...
* Added cookie foolCookie="c8ada45a-335a-4a3c-9957-965554dc01cc" for domain localhost, path /fool, expire 0
< Set-Cookie: foolCookie=c8ada45a-335a-4a3c-9957-965554dc01cc; Path=/fool
...
$ cat test.txt
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
localhost FALSE /fool FALSE 0 foolCookie c8ada45a-335a-4a3c-9957-965554dc01cc
When I run the next command, it replaces the cookie and varies the routing so it isn’t sticky.
$ curl -v -b test.txt http://localhost:8000/foo
...
* Replaced cookie foolCookie="c272f0c9-abf1-415d-9ffd-76feb4e94fe7" for domain localhost, path /fool, expire 0
< Set-Cookie: foolCookie=c272f0c9-abf1-415d-9ffd-76feb4e94fe7; Path=/fool
...
Kong version 1.2.1 - pulled from docker hub.
Thanks for your help.