Re: Building HAProxy 1.8 fails on Solaris
Actually, we can successfully compile the latest 1.7 on the same Solaris setup, without USE_PTHREAD_PSHARED. You're right about the patch, though; it seems unnecessary with that flag. Thanks! On Saturday, 21 July 2018, 10:07:41 am AEST, Olivier Houchard wrote: My patch won't be applied, so it'll behave the exact same way it used to. Reading the 1.6 code, the calls to __sync_lock* were already there, so it probably did not compile on Solaris with a gcc older than 4.1, unless USE_PTHREAD_PSHARED was defined. Regards, Olivier
Re: Help with environment variables in config
On Sat, Jul 21, 2018 at 05:44:44PM +0100, Jonathan Matthews wrote: > No. Sudo doesn't pass envvars through to its children by default: > https://stackoverflow.com/questions/8633461/how-to-keep-environment-variables-when-using-sudo > > Read that page *and* the comments - in particular be aware that you have to > request (at the CLI) that sudo preserve envvars, and you also have to have > been granted permission to do this, via the sudoers config file. > > If this is all sounding a bit complicated, that's because it is. > > You've chosen a relatively uncommon way of running haproxy - directly, via > sudo. Consider running via an init script or systemd unit (?) or, failing > that, just a script which is itself the sudo target, which sets the envvars > in the privileged environment. Also, something that people don't necessarily know is that haproxy can set its own variables using "setenv" in the global sections. Some will say this is stupid since you're going to use them in the same config, but when you add to this the fact that we can load multiple files, it becomes more obvious that it easily allows to parse an environment file first made of a global section with a few variables, then the regular (possibly shared) config. Typically it would do something like this : $ cat /etc/haproxy/env.cfg global setenv GRAPH_ADDRESS graph.server.com setenv GRAPH_PORT 8182 $ sudo haproxy -D -f /etc/haproxy/env.cfg -f /etc/haproxy/haproxy.cfg Hoping this helps, Willy
Re: Regexp
ok found it, It should be url_reg not path_reg It works now Haim Ari / SysOps Manager M: 972.584563032 / T: 972.722288367 From: Haim Ari Sent: Sunday, July 22, 2018 2:51:41 PM To: Aleksandar Lazic Cc: haproxy@formilux.org Subject: Re: Regexp And the config is: frontend HTTP-In option http-buffer-request bind-process 1 2 acl publisher-x path_reg ^\/1\.0\/manage\/bu\/ca\?token=.*seg=.*partner=987654321.* use_backend web1 if publisher-x bind 217.65.36.201:80 bind 217.65.36.202:80 bind 217.65.36.203:80 bind 217.65.36.204:80 maxconn 1 timeout client-fin 10s default_backend in - backend web1 fullconn 2000 timeout queue 1s option httpchk GET /keepalive_check balanceroundrobin option abortonclose option forwardfor timeout server 10s http-request set-header X-Forwarded-Port %[dst_port] http-request add-header X-Forwarded-Proto https if { ssl_fc } server web-1 192.168.192.168:8990 weight 100 check inter 10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s Haim Ari / SysOps Manager M: 972.584563032 / T: 972.722288367 From: Haim Ari Sent: Sunday, July 22, 2018 2:44:11 PM To: Aleksandar Lazic Cc: haproxy@formilux.org Subject: Re: Regexp Version: HA-Proxy version 1.8.1-1ppa1~xenial 2017/12/04 Use case: Need to direct these path_reg to a none default backend req: /1.0/manage/bu/ca?token=68b6f68b6f68b6f68b6f=123456789=987654321=1=CP=AF%2CAX%2CAL%2CDZ%2CAS%2CAD%2CAO%2CAI%2CAQ%2CAG%2CAR%2CAM%2CAW%2CAU%2CAT%2CAZ%2CBS%2CBH%2CBD%2CBB%2CBY%2CBE%2CBZ%2CBJ%2CBM%2CBT%2CBO%2CBA%2CBW%2CBV%2CBR%2CIO%2CBN%2CBG%2CBF%2CBI%2CKH%2CCM%2CCA%2CCV%2CKY%2CCF%2CTD%2CCL%2CCN%2CCX%2CCC%2CCO%2CKM%2CCG%2CCD%2CCK%2CCR%2CCI%2CHR%2CCU%2CCY%2CCZ%2CDK%2CDJ%2CDM%2CDO%2CEC%2CEG%2CSV%2CGQ%2CER%2CEE%2CET%2CFK%2CFO%2CFJ%2CFI%2CFR%2CGF%2CPF%2CTF%2CGA%2CGM%2CGE%2CDE%2CGH%2CGI%2CGR%2CGL%2CGD%2CGP%2CGU%2CGT%2CGG%2CGN%2CGW%2CGY%2CHT%2CHM%2CVA%2CHN%2CHK%2CHU%2CIS%2CIN%2CID%2CIR%2CIQ%2CIE%2CIM%2CIL%2CIT%2CJM%2CJP%2CJE%2CJO%2CKZ%2CKE%2CKI%2CKP%2CKR%2CKW%2CKG%2CLA%2CLV%2CLB%2CLS%2CLR%2CLY%2CLI%2CLT%2CLU%2CMO%2CMK%2CMG%2CMW%2CMY%2CMV%2CML%2CMT%2CMH%2CMQ%2CMR%2CMU%2CYT%2CMX%2CFM%2CMD%2CMC%2CMN%2CMS%2CMA%2CMZ%2CMM%2CNA%2CNR%2CNP%2CNL%2CAN%2CNC%2CNZ%2CNI%2CNE%2CNG%2CNU%2CNF%2CMP%2CNO%2COM%2CPK%2CPW%2CPS%2CPA%2CPG%2CPY%2CPE%2CPH%2CPN%2CPL%2CPT%2CPR%2CQA%2CRE% The regexp i tried and works externally : ^\/1\.0\/manage\/bu\/ca\?token=.*seg=.*partner=98765432.* Thank you Haim Ari / SysOps Manager M: 972.584563032 / T: 972.722288367 From: Aleksandar Lazic Sent: Friday, July 20, 2018 1:03 AM To: Haim Ari Cc: haproxy@formilux.org Subject: Re: Regexp Hi. On 18/07/2018 13:10, Haim Ari wrote: >Hello, > >Trying to set backend by regexp > >This regexp works outside of haproxy > >String: > >/1.0/manage/bu/ca?token=68bf68bf68bf68bf68bf=1212121212=123456789 > >Regexp: > >^\/1\.0\/manage\/bu\/ca\?token=.*.segId=.*=123456789 > >What is the right syntax for this in haproxy ? I would use https://regex101.com/r/TjH7Ul/1/ ^\/1\.0\/manage\/bu\/ca\?token=(.*).segId=(.*).partner=123456789 and backref \1 \2 But that's just a wild guess as the information's from you are very small. Which version of haproxy (haproxy -vv)? Which use case do you have? http-request/http-response/acl/..? Some config snipped would also help a little bit ;-). >Thank you Best regards Aleks
Re: Regexp
And the config is: frontend HTTP-In option http-buffer-request bind-process 1 2 acl publisher-x path_reg ^\/1\.0\/manage\/bu\/ca\?token=.*seg=.*partner=987654321.* use_backend web1 if publisher-x bind 217.65.36.201:80 bind 217.65.36.202:80 bind 217.65.36.203:80 bind 217.65.36.204:80 maxconn 1 timeout client-fin 10s default_backend in - backend web1 fullconn 2000 timeout queue 1s option httpchk GET /keepalive_check balanceroundrobin option abortonclose option forwardfor timeout server 10s http-request set-header X-Forwarded-Port %[dst_port] http-request add-header X-Forwarded-Proto https if { ssl_fc } server web-1 192.168.192.168:8990 weight 100 check inter 10s minconn 10 maxconn 200 maxqueue 1 slowstart 120s Haim Ari / SysOps Manager M: 972.584563032 / T: 972.722288367 From: Haim Ari Sent: Sunday, July 22, 2018 2:44:11 PM To: Aleksandar Lazic Cc: haproxy@formilux.org Subject: Re: Regexp Version: HA-Proxy version 1.8.1-1ppa1~xenial 2017/12/04 Use case: Need to direct these path_reg to a none default backend req: /1.0/manage/bu/ca?token=68b6f68b6f68b6f68b6f=123456789=987654321=1=CP=AF%2CAX%2CAL%2CDZ%2CAS%2CAD%2CAO%2CAI%2CAQ%2CAG%2CAR%2CAM%2CAW%2CAU%2CAT%2CAZ%2CBS%2CBH%2CBD%2CBB%2CBY%2CBE%2CBZ%2CBJ%2CBM%2CBT%2CBO%2CBA%2CBW%2CBV%2CBR%2CIO%2CBN%2CBG%2CBF%2CBI%2CKH%2CCM%2CCA%2CCV%2CKY%2CCF%2CTD%2CCL%2CCN%2CCX%2CCC%2CCO%2CKM%2CCG%2CCD%2CCK%2CCR%2CCI%2CHR%2CCU%2CCY%2CCZ%2CDK%2CDJ%2CDM%2CDO%2CEC%2CEG%2CSV%2CGQ%2CER%2CEE%2CET%2CFK%2CFO%2CFJ%2CFI%2CFR%2CGF%2CPF%2CTF%2CGA%2CGM%2CGE%2CDE%2CGH%2CGI%2CGR%2CGL%2CGD%2CGP%2CGU%2CGT%2CGG%2CGN%2CGW%2CGY%2CHT%2CHM%2CVA%2CHN%2CHK%2CHU%2CIS%2CIN%2CID%2CIR%2CIQ%2CIE%2CIM%2CIL%2CIT%2CJM%2CJP%2CJE%2CJO%2CKZ%2CKE%2CKI%2CKP%2CKR%2CKW%2CKG%2CLA%2CLV%2CLB%2CLS%2CLR%2CLY%2CLI%2CLT%2CLU%2CMO%2CMK%2CMG%2CMW%2CMY%2CMV%2CML%2CMT%2CMH%2CMQ%2CMR%2CMU%2CYT%2CMX%2CFM%2CMD%2CMC%2CMN%2CMS%2CMA%2CMZ%2CMM%2CNA%2CNR%2CNP%2CNL%2CAN%2CNC%2CNZ%2CNI%2CNE%2CNG%2CNU%2CNF%2CMP%2CNO%2COM%2CPK%2CPW%2CPS%2CPA%2CPG%2CPY%2CPE%2CPH%2CPN%2CPL%2CPT%2CPR%2CQA%2CRE% The regexp i tried and works externally : ^\/1\.0\/manage\/bu\/ca\?token=.*seg=.*partner=98765432.* Thank you Haim Ari / SysOps Manager M: 972.584563032 / T: 972.722288367 From: Aleksandar Lazic Sent: Friday, July 20, 2018 1:03 AM To: Haim Ari Cc: haproxy@formilux.org Subject: Re: Regexp Hi. On 18/07/2018 13:10, Haim Ari wrote: >Hello, > >Trying to set backend by regexp > >This regexp works outside of haproxy > >String: > >/1.0/manage/bu/ca?token=68bf68bf68bf68bf68bf=1212121212=123456789 > >Regexp: > >^\/1\.0\/manage\/bu\/ca\?token=.*.segId=.*=123456789 > >What is the right syntax for this in haproxy ? I would use https://regex101.com/r/TjH7Ul/1/ ^\/1\.0\/manage\/bu\/ca\?token=(.*).segId=(.*).partner=123456789 and backref \1 \2 But that's just a wild guess as the information's from you are very small. Which version of haproxy (haproxy -vv)? Which use case do you have? http-request/http-response/acl/..? Some config snipped would also help a little bit ;-). >Thank you Best regards Aleks
Re: Regexp
Version: HA-Proxy version 1.8.1-1ppa1~xenial 2017/12/04 Use case: Need to direct these path_reg to a none default backend req: /1.0/manage/bu/ca?token=68b6f68b6f68b6f68b6f=123456789=987654321=1=CP=AF%2CAX%2CAL%2CDZ%2CAS%2CAD%2CAO%2CAI%2CAQ%2CAG%2CAR%2CAM%2CAW%2CAU%2CAT%2CAZ%2CBS%2CBH%2CBD%2CBB%2CBY%2CBE%2CBZ%2CBJ%2CBM%2CBT%2CBO%2CBA%2CBW%2CBV%2CBR%2CIO%2CBN%2CBG%2CBF%2CBI%2CKH%2CCM%2CCA%2CCV%2CKY%2CCF%2CTD%2CCL%2CCN%2CCX%2CCC%2CCO%2CKM%2CCG%2CCD%2CCK%2CCR%2CCI%2CHR%2CCU%2CCY%2CCZ%2CDK%2CDJ%2CDM%2CDO%2CEC%2CEG%2CSV%2CGQ%2CER%2CEE%2CET%2CFK%2CFO%2CFJ%2CFI%2CFR%2CGF%2CPF%2CTF%2CGA%2CGM%2CGE%2CDE%2CGH%2CGI%2CGR%2CGL%2CGD%2CGP%2CGU%2CGT%2CGG%2CGN%2CGW%2CGY%2CHT%2CHM%2CVA%2CHN%2CHK%2CHU%2CIS%2CIN%2CID%2CIR%2CIQ%2CIE%2CIM%2CIL%2CIT%2CJM%2CJP%2CJE%2CJO%2CKZ%2CKE%2CKI%2CKP%2CKR%2CKW%2CKG%2CLA%2CLV%2CLB%2CLS%2CLR%2CLY%2CLI%2CLT%2CLU%2CMO%2CMK%2CMG%2CMW%2CMY%2CMV%2CML%2CMT%2CMH%2CMQ%2CMR%2CMU%2CYT%2CMX%2CFM%2CMD%2CMC%2CMN%2CMS%2CMA%2CMZ%2CMM%2CNA%2CNR%2CNP%2CNL%2CAN%2CNC%2CNZ%2CNI%2CNE%2CNG%2CNU%2CNF%2CMP%2CNO%2COM%2CPK%2CPW%2CPS%2CPA%2CPG%2CPY%2CPE%2CPH%2CPN%2CPL%2CPT%2CPR%2CQA%2CRE% The regexp i tried and works externally : ^\/1\.0\/manage\/bu\/ca\?token=.*seg=.*partner=98765432.* Thank you Haim Ari / SysOps Manager M: 972.584563032 / T: 972.722288367 From: Aleksandar Lazic Sent: Friday, July 20, 2018 1:03 AM To: Haim Ari Cc: haproxy@formilux.org Subject: Re: Regexp Hi. On 18/07/2018 13:10, Haim Ari wrote: >Hello, > >Trying to set backend by regexp > >This regexp works outside of haproxy > >String: > >/1.0/manage/bu/ca?token=68bf68bf68bf68bf68bf=1212121212=123456789 > >Regexp: > >^\/1\.0\/manage\/bu\/ca\?token=.*.segId=.*=123456789 > >What is the right syntax for this in haproxy ? I would use https://regex101.com/r/TjH7Ul/1/ ^\/1\.0\/manage\/bu\/ca\?token=(.*).segId=(.*).partner=123456789 and backref \1 \2 But that's just a wild guess as the information's from you are very small. Which version of haproxy (haproxy -vv)? Which use case do you have? http-request/http-response/acl/..? Some config snipped would also help a little bit ;-). >Thank you Best regards Aleks