On 11/10/2015 12:00 AM, Aleksandar Lazic wrote:
Hi Sylvain Faivre.
Am 09-11-2015 17:31, schrieb Sylvain Faivre:
Hi,
Sorry I'm late on this discussion, following this thread :
https://marc.info/?l=haproxy&m=143345620219498&w=2
We are using appsession with HAproxy 1.5 like this :
Thanks ;-)
backend http
appsession JSESSIONID len 24 timeout 1h request-learn
We would like to be able to do the same thing with HAproxy 1.6.
If it is possible, we'd like to catch the JSESSIONID in cookies and
URL parameters, either in the request or in the response.
I tried to use the info posted previously by Aleksandar, but I
encountered several problems :
- using "stick on" in frontend section fails with :
'stick' ignored because frontend 'web' has no backend capability.
- using "stick store-response urlp(JSESSIONID,;)" in backend section
fails with :
'stick': fetch method 'urlp' extracts information from 'HTTP request
headers', none of which is available for 'store-response'.
So, I've got this so far :
backend http
stick-table type string len 24 size 10m expire 1h peers prod
stick on urlp(JSESSIONID,;)
stick on cookie(JSESSIONID)
Does this seem right ?
The help for "stick on" tells it defines a request pattern, so I guess
this would not match JSESSIONID cookie ou url parameter set in the
reply ?
I have no java server here to test this commands but with this commands
haproxy does not warn you about some config errors ;-).
###
backend dest01
mode http
stick-table type string len 24 size 10m expire 1h peers prod
stick on urlp(JSESSIONID,;)
stick on cookie(JSESSIONID)
stick store-response cookie(JSESSIONID)
# stick store-response res.hdr(JSESSIONID,;)
stick store-request cookie(JSESSIONID)
stick store-request urlp(JSESSIONID,;)
server srv_dest01 dest01.com:80
###
I have not seen a good option to read the JSESSIONID from the response
header in case it is not in a cookie.
Have anyone I idea?!
Please can you post a full response header which was created from the
app or appserver when the app or appserver have detected that the client
does not allow cookies.
cheers
Aleks
Thank you Aleks.
In fact, the server sends the JSESSIONID as a cookie even if the client
does not support cookies, *and* it adds the JSESSIONID as a URL
parameter in all links, so this should be all right.
I just tried your config on a test server, and the session IDs are
rightly recorded in the table, whether the client accepts cookies or not.
I still have some test cases to run, I will check this next week and
report back if needed.
Regards,
Sylvain