Re: Using multiple url parameters to create sticky-table entries
That seems to work exactly as needed, thank you! I have so much to learn about haproxy, this helps immensely. I didn't even consider looking into defining custom headers and using them this way. Thanks! On Sat, Mar 25, 2017 at 3:13 AM, Jarno Huuskonenwrote: > Hi, > > On Fri, Mar 24, redundantl y wrote: > > I take it this isn't possible? > > How about something like this: > frontend xyz > http-request set-header X-STICK %[urlp(email),lower]%[urlp( > newsletter_id),lower] > > backend ... > stick on hdr(X-STICK) table detailspage > > -Jarno > > > Thanks. > > > > On Wed, Mar 22, 2017 at 6:01 PM, redundantl y > wrote: > > > > > I'm very, very new to HAproxy (started trying it out an hour ago) and > am > > > looking at setting up a sticky-table based on multiple url_params. > > > > > > I've got it working using a single parameter, but I'm wondering if I > can > > > set it up to create table entries (keys) based on multiple url_param > > > entries when found. For example using a URL like this: > > > > > > http://example.com/details?email=j...@example.com_id=12345 > > > > > > I'd like it to create a key based on the strings in both the email and > > > newsletter_id parameters. Right now if I use the following it'll use > just > > > email or newsletter_id if the former isn't found: > > > > > > stick on url_param(email) table detailspage > > > stick on url_param(newsletter_id) table detailspage > > > > > > What the sticky-table currently looks like: > > > > > > $ echo "show table detailspage" | socat unix:/var/run/haproxy.sock - > > > # table: detailspage, type: string, size:5242880, used:3 > > > 0x7f90f0cc9a24: key=12345 use=0 exp=596822 server_id=1 > > > 0x7f90f0cc9754: key=j...@example.com use=0 exp=593655 server_id=1 > > > 0x7f90f0cc9964: key=harryca...@example.com use=0 exp=595455 > server_id=2 > > > > > > Thanks. > > > > > -- > Jarno Huuskonen >
Re: Using multiple url parameters to create sticky-table entries
Hi, On Fri, Mar 24, redundantl y wrote: > I take it this isn't possible? How about something like this: frontend xyz http-request set-header X-STICK %[urlp(email),lower]%[urlp(newsletter_id),lower] backend ... stick on hdr(X-STICK) table detailspage -Jarno > Thanks. > > On Wed, Mar 22, 2017 at 6:01 PM, redundantl ywrote: > > > I'm very, very new to HAproxy (started trying it out an hour ago) and am > > looking at setting up a sticky-table based on multiple url_params. > > > > I've got it working using a single parameter, but I'm wondering if I can > > set it up to create table entries (keys) based on multiple url_param > > entries when found. For example using a URL like this: > > > > http://example.com/details?email=j...@example.com_id=12345 > > > > I'd like it to create a key based on the strings in both the email and > > newsletter_id parameters. Right now if I use the following it'll use just > > email or newsletter_id if the former isn't found: > > > > stick on url_param(email) table detailspage > > stick on url_param(newsletter_id) table detailspage > > > > What the sticky-table currently looks like: > > > > $ echo "show table detailspage" | socat unix:/var/run/haproxy.sock - > > # table: detailspage, type: string, size:5242880, used:3 > > 0x7f90f0cc9a24: key=12345 use=0 exp=596822 server_id=1 > > 0x7f90f0cc9754: key=j...@example.com use=0 exp=593655 server_id=1 > > 0x7f90f0cc9964: key=harryca...@example.com use=0 exp=595455 server_id=2 > > > > Thanks. > > -- Jarno Huuskonen
Re: Using multiple url parameters to create sticky-table entries
Am 24-03-2017 19:20, schrieb redundantl y: I take it this isn't possible? Thanks. On Wed, Mar 22, 2017 at 6:01 PM, redundantl ywrote: I'm very, very new to HAproxy (started trying it out an hour ago) and am looking at setting up a sticky-table based on multiple url_params. I've got it working using a single parameter, but I'm wondering if I can set it up to create table entries (keys) based on multiple url_param entries when found. For example using a URL like this: http://example.com/details?email=j...@example.com_id=12345 I'd like it to create a key based on the strings in both the email and newsletter_id parameters. Right now if I use the following it'll use just email or newsletter_id if the former isn't found: stick on url_param(email) table detailspage stick on url_param(newsletter_id) table detailspage how about to try this, it's untested. http-request set-var(req.mysticky) url_param(email),url_param(newsletter_id) stick on req.mysticky table detailspage I refer her to 1.7 due to the fact that you haven't told us which version you use http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#4.2-http-request What the sticky-table currently looks like: $ echo "show table detailspage" | socat unix:/var/run/haproxy.sock - # table: detailspage, type: string, size:5242880, used:3 0x7f90f0cc9a24: key=12345 use=0 exp=596822 server_id=1 0x7f90f0cc9754: key=j...@example.com use=0 exp=593655 server_id=1 0x7f90f0cc9964: key=harryca...@example.com use=0 exp=595455 server_id=2 Thanks.
Re: Using multiple url parameters to create sticky-table entries
I take it this isn't possible? Thanks. On Wed, Mar 22, 2017 at 6:01 PM, redundantl ywrote: > I'm very, very new to HAproxy (started trying it out an hour ago) and am > looking at setting up a sticky-table based on multiple url_params. > > I've got it working using a single parameter, but I'm wondering if I can > set it up to create table entries (keys) based on multiple url_param > entries when found. For example using a URL like this: > > http://example.com/details?email=j...@example.com_id=12345 > > I'd like it to create a key based on the strings in both the email and > newsletter_id parameters. Right now if I use the following it'll use just > email or newsletter_id if the former isn't found: > > stick on url_param(email) table detailspage > stick on url_param(newsletter_id) table detailspage > > What the sticky-table currently looks like: > > $ echo "show table detailspage" | socat unix:/var/run/haproxy.sock - > # table: detailspage, type: string, size:5242880, used:3 > 0x7f90f0cc9a24: key=12345 use=0 exp=596822 server_id=1 > 0x7f90f0cc9754: key=j...@example.com use=0 exp=593655 server_id=1 > 0x7f90f0cc9964: key=harryca...@example.com use=0 exp=595455 server_id=2 > > Thanks. >